Windows Server 2012 R2, POSH Ver 4.0:
We want to change the system time to a 12-hour clock instead of 24-clock. Any ideas are appreciated. We do not want to change the date - we only want to change the time format.
-Jason
Windows Server 2012 R2, POSH Ver 4.0:
We want to change the system time to a 12-hour clock instead of 24-clock. Any ideas are appreciated. We do not want to change the date - we only want to change the time format.
-Jason
Are you looking to change the short time format (ex. HH:mm) or long time format (ex. h:mm tt)? I was able to modify the long time format by using set-culture, but had no luck with short time:
$modCulture = Get-UICulture
($modCulture.DateTimeFormat).LongTimePattern = 'HH:mm:ss'
Set-Culture $modCulture
Chris, that code seems to also work similarly for changing the shorttime format unless I’m missing something. I tested this in a Windows 10 VM with PS5.0 so it’s not an identical environment but it seems to do the trick. I switched the call to the LongTimePattern property with one to ShortTimePattern, and updated the time pattern passed to it.
$modCulture = Get-UICulture ($modCulture.DateTimeFormat).ShortTimePattern = 'HH:mm' Set-Culture $modCulture
Thanks Vasken,
I’ll test again. I had attempted to do the same on a 2012 R2 system, but the Short Time pattern did not appear to change when I reran Get-UICulture.
It should also be noted that these are User specific settings so running Set-Culture will only affect the current user.
In the end, I’m not sure how helpful any of this is, but it looks like on my 2012 R2 server I can update the ShortTimePattern from 24-hour to 12-hour, however I get no love going the other way around (also notice it automatically corrected my typo by adding tt to the format):
PS > (Get-UICulture).DateTimeFormat | Select ShortTimePattern,LongTimePattern | fl
ShortTimePattern : HH:mm
LongTimePattern : HH:mm:ss
PS > $modCulture = Get-UICulture
PS > ($modCulture.DateTimeFormat).ShortTimePattern = “h:mm”
PS > ($modCulture.DateTimeFormat).LongTimePattern = “h:mm:ss”
PS > Set-Culture $modCulture
PS > (Get-UICulture).DateTimeFormat | Select ShortTimePattern,LongTimePattern | fl
ShortTimePattern : h:mm tt
LongTimePattern : h:mm:ss
PS > ($modCulture.DateTimeFormat).ShortTimePattern = “HH:mm”
PS > ($modCulture.DateTimeFormat).LongTimePattern = “HH:mm:ss”
PS > Set-Culture $modCulture
PS > (Get-UICulture).DateTimeFormat | Select ShortTimePattern,LongTimePattern | fl
ShortTimePattern : h:mm tt
LongTimePattern : HH:mm:ss