Ensure we are using an English locale for date formatting.

(as hinted by @nitzmahone)
This commit is contained in:
Dag Wieers 2016-06-09 00:36:48 +02:00
parent 30151bfadc
commit c293f7208a

View file

@ -128,7 +128,7 @@ Set-Attr $result.ansible_facts "ansible_user_uid" ([int] $user.User.Value.Substr
Set-Attr $result.ansible_facts "ansible_user_sid" $user.User.Value Set-Attr $result.ansible_facts "ansible_user_sid" $user.User.Value
# Use English locale # Use English locale
[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') $culture = New-Object System.Globalization.CultureInfo('en-US')
$date = New-Object psobject $date = New-Object psobject
$datetime = (Get-Date) $datetime = (Get-Date)
$datetime_utc = $datetime.ToUniversalTime() $datetime_utc = $datetime.ToUniversalTime()
@ -146,7 +146,7 @@ Set-Attr $date "second" $datetime.ToString("ss")
Set-Attr $date "time" $datetime.ToString("HH:mm:ss") Set-Attr $date "time" $datetime.ToString("HH:mm:ss")
Set-Attr $date "tz_offset" $datetime.ToString("zzzz") Set-Attr $date "tz_offset" $datetime.ToString("zzzz")
Set-Attr $date "tz" ([System.TimeZoneInfo]::Local.Id) Set-Attr $date "tz" ([System.TimeZoneInfo]::Local.Id)
Set-Attr $date "weekday" $datetime.ToString("dddd") Set-Attr $date "weekday" $datetime.ToString("dddd", $culture)
Set-Attr $date "weekday_number" (Get-Date -UFormat "%w") Set-Attr $date "weekday_number" (Get-Date -UFormat "%w")
Set-Attr $date "weeknumber" (Get-Date -UFormat "%W") Set-Attr $date "weeknumber" (Get-Date -UFormat "%W")
Set-Attr $date "year" $datetime.ToString("yyyy") Set-Attr $date "year" $datetime.ToString("yyyy")