When I logged into an old Cisco 2950 network switch today and checked the time on the switch, I found the date was July 29, 1993 rather than January 1, 2022.
Hoggle>show clock *23:47:16.884 UTC Thu Jul 29 1993 Hoggle>
show clock detail command revealed there was no time source
set for the switch.
Hoggle>show clock detail *23:49:39.464 UTC Thu Jul 29 1993 No time source Hoggle>
To set the time, I turned on the ability to enter privileged commands
Hoggle>enable Password: Hoggle#
I set the date and time to the current
Universal Time (UTC) values with the
set command. You can find the current UTC time at
Current UTC, Time
Zone (Coordinated Universal Time).
Hoggle#clock set 02:47:10 jan 2 2022 Hoggle#show clock 02:47:20.163 UTC Sun Jan 2 2022 Hoggle#
The format of the command is
clock set [hh:mm:ss] [month] [day]
[year] with the following permissible values:
- hh:mm:ss - Specifies the current time in hours in military format, aka 24-hour clock format, minutes, and seconds. So the value for hours can range from 0 to 23 while the values for minutes and seconds can range from 0 to 59.
- month - Specifies the current month using the first three letters of the month name. The range is from Jan (January) to Dec (December).
- day - Specifies the current day of the month from 1 to 31
- year - Specifies the current year as a 4-digit year. The range is from 2000 up to 2037.
You may prefer to have the time displayed in your local time. This switch
is in the Eastern
Time Zone of the United States (you can see the current time for
U.S. time zones at
TIME ZONES), so the local time is currently 5 hours behind UTC time.
To display the time in the local time zone, I entered the
terminal command to enter the Global Configuration context and then
specified the timezone as EST and indicated it is minus 5 hours from
Hoggle#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Hoggle(config)#clock timezone EST -5 Hoggle(config)#
The format for the command is
clock timezone [zone] [hours-offset]
[minutes-offset]. The options for the command are as follows:
- zone - The acronym of the time zone, which can be up to four characters in length.
- hours-offset - The hours difference from UTC. The range is from -12 to +13.
- minutes-offset - (Optional) The minutes difference from UTC. The range is from 0 to 59.
You can exit the Global Configuration context with Ctrl-Z. If you then
show clock command you should see the date and time
matching your local time.
Hoggle(config)#^Z Hoggle#show clock 22:17:01.987 EST Sat Jan 1 2022 Hoggle#