New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get-Date -UFormat does not match reference implementation [meta] #20982
Comments
$ & {
'locale : {0}' -f $env:LC_TIME
'PSCulture: {0}' -f [Threading.Thread]::CurrentThread.CurrentCulture
$mods =
"a","A","b","B","c","C","d","D","e","F","h","H",
"I","j","k","l","m","M","N","p","P","q","r","R",
"s","S","T","u","U","V","w","W","x","X","y","Y",
"z","Z"
$mods | % {
[pscustomobject] @{
'mode' = "%$_"
'UFormat'= Get-Date '2023-12-31' -uf "%$_"
'date' = date -d 2023-12-31 "+%$_"
}
}}
locale : en_US.UTF-8
PSCulture: en-US
mode UFormat date
---- ------- ----
%a Sun Sun
%A Sunday Sunday
%b Dec Dec
%B December December
%c Sun 31 Dec 2023 00:00:00 Sun 31 Dec 2023 12:00:00 AM TMZ
%C 20 20
%d 31 31
%D 12/31/23 12/31/23
%e 31 31
%F 2023-12-31 2023-12-31
%h Dec Dec
%H 00 00
%I 12 12
%j 365 365
%k 0 0
%l 12 12
%m 12 12
%M 00 00
%N N 000000000
%p AM AM
%P P am
%q q 4
%r 12:00:00 AM 12:00:00 AM
%R 00:00 00:00
%s 1703970000 1703970000
%S 00 0
%T 00:00:00 00:00:00
%u 7 7
%U 52 52
%V 52 52
%w 0 0
%W 52 52
%x 12/31/23 12/31/2023
%X 00:00:00 12:00:00 AM
%y 23 23
%Y 2023 2023
%z z +0000
%Z +00 TMZ |
It would be nice to add a column for strftime. |
Found on Arch Wiki:
$ & {
'locale : {0}' -f $env:LC_TIME
'PSCulture: {0}' -f [Threading.Thread]::CurrentThread.CurrentCulture
$mods =
"a","A","b","B","c","C","d","D","e","F","h","H",
"I","j","k","l","m","M","N","p","P","q","r","R",
"s","S","T","u","U","V","w","W","x","X","y","Y",
"z","Z"
$mods | % {
[pscustomobject] @{
'mode' = "%$_"
'UFormat'= Get-Date -uf "%$_"
'date' = date "+%$_"
'strftime' = ./a.out "%$_"
}
}} Output (TMZ is your timezone abbreviation):
|
I suggest to get WG conclusion that we want the Reference implementation I suggest comparing our implementation with these, add what is missing, and correct deviations. |
Prerequisites
History #4750
Steps to reproduce
History #4750
Get-Date -UFormat
Format specifiers
See Date conversion specifiers or strftime.
Based on running the
date -d $date +%c
as a reference implementation (see Environment for details).Expected behavior
Actual behavior
Error details
No response
Environment data
Visuals
No response
The text was updated successfully, but these errors were encountered: