PowerShell/PowerShell-Tests

fix date compare to use correct hour format lower case in GetDateFormatUpdates

vairam-svs opened this issue · 3 comments

fix date compare to use correct hour format lower case:
Describing GetDateFormatUpdates
[+] Verifies that FileDate format works 51ms
[+] Verifies that FileDateUniversal format works 23ms
[-] Verifies that FileDateTime format works 27ms
String lengths are both 19. Strings differ at index 9.
Expected: {20160107T0004182547}
But was: {20160107T1204182547}
--------------------^
24: $actualFormat | Should be $expectedFormat
at , C:\PowerShell-Tests\Commands\Cmdlets\MiscCmdletUpdates.Tests.ps1: line 24

I'm not sure what's going on here, but HH is what is being used internally by the cmdlet

timeformat
time format 24 hour is H 12 hour is h

I get the following for 3:35 PM pacific on a windows 8.1 with PS 5 - wmf 5.0 Preview latest Installed

PS C:\windows\system32> Get-Date -Format FileDateTime
20160115T0335052325

Hmm, seems like a bug in Powershell Cmdlet Get-Date: (it states it is a 24 hour format, but says it will be hhmmssmsms where h is a 12 hour format)
https://technet.microsoft.com/en-us/library/hh849887.aspx
-- FileDateTime - A file or path-friendly representation of the current date and time in local time, in 24-hour format. It is in the form of yyyymmdd + 'T' + hhmmssmsms, where msms is a four-character representation of milliseconds. An example of results when you use this format is 20150302T1240514987.