You can use the date and time commands on a Microsoft Windows system to display current date and time information:
C:\Users\Lila>date /t Sat 08/26/2017 C:\Users\Lila>time /t 02:07 PM C:\Users\Lila>
Placing /t
after the commands results in the current date
and time information being displayed without an accompanying prompt to change
the current settings.
You can display the information in a different format using the Windows Management Instrumentation Command-line (WMIC) command shown below:
C:\Users\Lila>wmic path win32_utctime get * /format:list Day=26 DayOfWeek=6 Hour=18 Milliseconds= Minute=16 Month=8 Quarter=3 Second=19 WeekInMonth=4 Year=2017 C:\Users\Lila>
The output will show the day and the number for the day of the week, e.g., 6 for Saturday (the numbering starts with Monday as the first day of the week). The WMIC command also shows the number of seconds, the quarter of the year, and the week in the current month, which are not shown by the time command.
The hour is displayed in 24-hour clock time, aka "military time." In the example above, since the local time is 2:07 PM, the hour value is 18, because two o'clock is 14:00 in 24-hour clock time with 4 hours added to the number of hours to make the value 18, since the system is in the Eastern Time Zone , currently Eastern Daylight Time (EDT), in the United States, which is currently 4 hours behind Coordinated Universal Time, which is abbreviated as UTC. There is a 5 hour time difference when Eastern Standard Time (EST) applies. You can see the current U.S. time zones at Time Zones Currently Being Used in United States.
You can find the time zone the Windows system is in with the command shown below:
C:\>systeminfo | find "Time Zone:" Time Zone: (UTC-05:00) Eastern Time (US & Canada) C:\>
The command above shows there is a 5 hour difference between the time zone the system is in and UTC time, aka Zulu time or GMT, but that is only the case when Eastern Standard Time (EST) is in effect, not when Eastern Daylight Time (EDT) is in effect.
If you omit the /format:list
parameter at the end of the
wmic path win32_utctime get *
command, all of the values will be
displayed on one line:
C:\>wmic path win32_utctime get * Day DayOfWeek Hour Milliseconds Minute Month Quarter Second WeekInMonth Year 26 6 18 32 8 3 11 4 2017 C:\>
You can also specify the particular values you are interested rather than getting all values with the asterisk. E.g.:
C:\>wmic path win32_utctime get hour, minute, second Hour Minute Second 18 34 47 C:\>wmic path win32_utctime get quarter Quarter 3 C:\>wmic path win32_utctime get weekinmonth WeekInMonth 4 C:\>wmic path win32_utctime get hour, minute, second Hour Minute Second 18 35 13 C:\>
If I want to know whether daylight saving time (DST) is currently in effect, I can open a PowerShell window and use the command shown below:
PS C:\Users\Lila> Get-CimInstance Win32_TimeZone | select * Caption : (UTC-05:00) Eastern Time (US & Canada) Description : (UTC-05:00) Eastern Time (US & Canada) SettingID : Bias : -300 DaylightBias : -60 DaylightDay : 2 DaylightDayOfWeek : 0 DaylightHour : 2 DaylightMillisecond : 0 DaylightMinute : 0 DaylightMonth : 3 DaylightName : Eastern Daylight Time DaylightSecond : 0 DaylightYear : 0 StandardBias : 0 StandardDay : 1 StandardDayOfWeek : 0 StandardHour : 2 StandardMillisecond : 0 StandardMinute : 0 StandardMonth : 11 StandardName : Eastern Standard Time StandardSecond : 0 StandardYear : 0 PSComputerName : CimClass : root/cimv2:Win32_TimeZone CimInstanceProperties : {Caption, Description, SettingID, Bias...} CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties PS C:\Users\Lila>
The StandardHour
, StandardDay
,
StandardDayOfWeek
, and StandardMonth
values tell me
when standard time goes into effect on this system. Since
StandardMonth
is 11, I know that it takes effect in November. The
StandardDayofWeek
value is zero, which indicates the change occurs
on the first day of the week, i.e., Sunday and the StandardDay
value of 1 indicates that the change occurs on the first Sunday of
StandardMonth
, i.e., the first Sunday in November. The
StandardHour
value of 2 tells me the time change takes place
at 2:00 AM on that day, i.e., the change occurs on the first Sunday in
November at 2:00 AM.
Likewise, I can examine the "Daylight" values to determine when daylight savings time begins:
DaylightDay : 2 DaylightDayOfWeek : 0 DaylightHour : 2 DaylightMillisecond : 0 DaylightMinute : 0 DaylightMonth : 3
I can see from the above that, for this system, daylight savings time begins on the second Sunday of March at 2:00 AM EST when clocks are advanced one hour to 3:00 AM EDT, leaving a one hour gap. The mnemonic for the time changes is "spring forward, fall back." You can see the calendar dates for daylight saving time for recent years and future years at Daylight saving time in the United States.
You can select individual values by specifying the value you are interested in instead of using an asterisk after "select". E.g.:
PS C:\Users\Lila> Get-CimInstance Win32_TimeZone | select DaylightName DaylightName ------------ Eastern Daylight Time PS C:\Users\Lila> Get-CimInstance Win32_TimeZone | select DaylightName, StandardName DaylightName StandardName ------------ ------------ Eastern Daylight Time Eastern Standard Time PS C:\Users\Lila>
Related articles:
References: