Skip to content

Get-Date -UFormat inconsistencies compared to Linux strftime #4750

Description

With reference to #4264 first reported by chuanjiao10 - on further examination there are a number of UFormats outputs which diverge from the output under Linux. Because the UFormat parameter is supposed to be UNIX format, the output should match that of the date command (i.e. strftime) on Linux.

It's clear that some of the divergences are simple format issues, for instance leading zeros. Others are down to following the ISO 8601 week date specification (https://en.wikipedia.org/wiki/ISO_week_date). And others appear to be differences between locale data on Linux and .Net. In these latter cases it looks like the C locale is followed, which may actually be the best that can be done given the lack of Linux locale data.

%c

en-US

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0  -UFormat %c                                                   
Sat Jan  1 01:00:00 2005

Linux

LC_TIME="en_US.UTF-8" date -d 2005-01-01T01:00:00 +%c
Sat 01 Jan 2005 01:00:00 AM GMT

C

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0  -UFormat %c                                                   
Sat Jan  1 01:00:00 2005

Linux

LC_TIME="C.UTF-8" date -d 2005-01-01T01:00:00 +%c
Sat Jan  1 01:00:00 2005

%g

en-US

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0  -UFormat %g                                                     
05

Linux

LC_TIME="en_US.UTF-8" date -d 2005-01-01T01:00:00 +%g
04

%G

en-US

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0  -UFormat %g                                                     
2005

Linux

LC_TIME="en_US.UTF-8" date -d 2005-01-01T01:00:00 +%G
2004

%j

en-US

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0  -UFormat %j                                                    
1

Linux

LC_TIME="en_US.UTF-8" date -d 2005-01-01T01:00:00 +%j
001

%k

en-US

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0  -UFormat %k                                                    
01

Linux

LC_TIME="en_US.UTF-8" date -d 2005-01-01T01:00:00 +%k
 1

%l

en-US

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0  -UFormat %l                                                   
01

Linux

LC_TIME="en_US.UTF-8" date -d 2005-01-01T01:00:00 +%l
 1

%s

en-US

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0 -Millisecond 0  -UFormat %s                                                 
1104541200

Linux

LC_TIME="en_US.UTF-8" date -d 2005-01-01T01:00:00 +%s
1104541200
[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0 -Millisecond 1 -UFormat %s                                                 
1104541200.001

Linux

LC_TIME="en_US.UTF-8" date -d 2005-01-01T01:00:00.001 +%s
 1104541200

%u

en-US

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 2 -Hour 1 -Minute 0 -Second 0  -UFormat %u
0

Linux

LC_TIME="en_US.UTF-8" date -d 2005-01-02T01:00:00 +%u
7

%U

  • The week number of the current year as a decimal number, range 00 to 53, starting with the first Sunday as the first day of week 01.

en-US

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0  -UFormat %U                                                   
0

Linux

LC_TIME="en_US.UTF-8" date -d 2005-01-01T01:00:00 +%U
00

%V

  • The ISO 8601 week number ... of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the new year.

en-US

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0  -UFormat %V                                                   
1

Linux

LC_TIME="en_US.UTF-8" date -d 2005-01-01T01:00:00 +%V
53

%W

  • The week number of the current year as a decimal number, range 00 to 53, starting with the first Monday as the first day of week 01.

en-US

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0  -UFormat %W                                                   
0

Linux

LC_TIME="en_US.UTF-8" date -d 2005-01-01T01:00:00 +%W
00

%x

  • The preferred date representation for the current locale without the time.

en-US

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0  -UFormat %x                                                 
01/01/05

Linux

LC_TIME="en_US.UTF-8" date -d 2005-01-01T01:00:00 +%x
01/01/2005

C

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0  -UFormat %x                                                 
01/01/05

Linux

LC_TIME="C.UTF-8" date -d 2005-01-01T01:00:00 +%x
01/01/05

%X

  • The preferred date representation for the current locale without the time.

en-US

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0  -UFormat %X                                                 
01:00:00

Linux

LC_TIME="en_US.UTF-8" date -d 2005-01-01T01:00:00 +%X
01:00:00 AM

C

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0  -UFormat %X                                                 
01:00:00

Linux

LC_TIME="C.UTF-8" date -d 2005-01-01T01:00:00 +%X
01:00:00

%Z

  • The timezone name or abbreviation.

en-US

PowerShell

[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
get-date -Year 2005 -Month 1 -Day 1 -Hour 1 -Minute 0 -Second 0  -UFormat %Z                                                
+00

Linux

LC_TIME="en_US.UTF-8" date -d 2005-01-01T01:00:00 +%Z
GMT
> $PSVersionTable
Name                           Value                                           
----                           -----                                           
PSVersion                      6.0.0-beta                                      
PSEdition                      Core                                            
GitCommitId                    v6.0.0-beta.5                                   
OS                             Linux 4.10.0-32-generic #36~16.04.1-Ubuntu SM...
Platform                       Unix                                            
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                         
PSRemotingProtocolVersion      2.3                                             
SerializationVersion           1.1.0.1                                         
WSManStackVersion              3.0  

I initially, naively, made PR #4508 for #4264 which simply used the GetWeekOfYear method from the Gregorian Calendar. Unfortunately that is too simplistic, and the formula needs to be followed to determine the correct week number. I suggest that PR be closed and new PRs to be created against this tracking issue. My suggestion is that the Pester tests be broken out into a test per UFormat to make this easier (with the failing tests commented until they can be addressed).

Activity

  1. changed the title [-]Get-Date -UFormat inconsitencies compared to Linux strftime[/-] [+]Get-Date -UFormat inconsistencies compared to Linux strftime[/+] on Sep 4, 2017
  2. iSazonov commented on Sep 4, 2017

    @iSazonov
    Collaborator

    It seems the formatting can differ between different Linux distributions (I tested on WSL) so I would exclude such points from the Issue.

    Please reformat the Issue.

  3. timparkinson commented on Sep 4, 2017

    @timparkinson
    Author

    I've checked on Ubuntu 14.04, Ubuntu 16.04 and CentOS 7 machines and the formatting is consistent between them. I don't have a machine with WSL on it handy at the moment to test. Furthermore, the descriptions of the format codes in the strftime man pages do specify format. For instance %k - Get-Date current behaviour is to output with a leading zero, whereas per stfrtime man page:

    The hour (24-hour clock) as a decimal number (range 0 to 23); single digits are preceded by a blank.

    What formatting changes do you want me to make to the issue?

  4. iSazonov commented on Sep 4, 2017

    @iSazonov
    Collaborator

    What formatting changes do you want me to make to the issue?

    It is difficult to read the Issue description 😕

    Steve Lee (@SteveL-MSFT) Should we fix the formattings? Do PowerShell-Committee conclusion in #4508 cover this?

  5. SteveL-MSFT commented on Sep 4, 2017

    @SteveL-MSFT
    Member

    Is there a RFC or something more canonical than specific distro implementations we can refer to?

  6. iSazonov commented on Sep 5, 2017

    @iSazonov
    Collaborator
  7. SteveL-MSFT commented on Sep 5, 2017

    @SteveL-MSFT
    Member

    Regarding formatting of the issue, I can read each format and the comparison between PowerShell and Linux, so it seems readable enough to me. Ilya (@iSazonov) if you have a suggestion on how to make this more readable, feel free to offer it. It's just long which makes it difficult, but probably better than having multiple separate issues. Per the ietf link, I believe we should be prefixing with zeros so that there's always two digits, but I'm no expert on this topic.

  8. iSazonov commented on Sep 5, 2017

    @iSazonov
    Collaborator

    I slightly reformatted.
    I agree that we only need the one Issue. Based on #4508 long discussion it seems better to fix each position in a separate PR where discuss, fix and add tests.

  9. SteveL-MSFT commented on Sep 5, 2017

    @SteveL-MSFT
    Member

    Ilya (@iSazonov) agree that it would be better to have separate PRs making it easier to review. Also, are these all things we should change in PowerShell or should they be changes in corefx? Some formats I believe the cmdlet implements, but some come from corefx.

  10. iSazonov commented on Sep 5, 2017

    @iSazonov
    Collaborator

    I don't analyze all but it seems most should be fixed in PowerShell repo.

  11. iSazonov commented on Sep 7, 2017

    @iSazonov
    Collaborator

    Open #4796 to fix %c.

  12. iSazonov commented on Sep 11, 2017

    @iSazonov
    Collaborator

    Open #4805 to fix %j.

  13. brianary commented on Jan 5, 2021

    @brianary
    Contributor

    The %u format specifier should also be included. ISO says Sunday is 7, not 0.

    %u

    The ISO 8601 day of the week 1-7 (M-Su).

    en-US

    PowerShell

    [System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
    get-date -Year 2005 -Month 1 -Day 2 -Hour 1 -Minute 0 -Second 0  -UFormat %u
    0
    

    Linux

    LC_TIME="en_US.UTF-8" date -d 2005-01-02T01:00:00 +%u
    7
    

    This is important in order to format an accurate ISO8601 week date 📺, using %G-W%V-%u, which all have to work consistently with each other.

    %G-W%V-%u

    The ISO 8601 week-based date.

    en-US

    PowerShell

    [System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 
    get-date -Year 2021 -Month 1 -Day 3 -Hour 1 -Minute 0 -Second 0  -UFormat %G-W%V-%u
    2021-W53-0
    

    Linux

    LC_TIME="en_US.UTF-8" date -d 2021-01-03T01:00:00 +%G-W%V-%u
    2020-W53-7
    
  14. 8 remaining items

  15. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  16. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  17. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  18. brianary commented on Nov 17, 2023

    @brianary
    Contributor

    It looks like there is more work to do, just based on a quick test of the value 2023-11-14T14:13:20-08:

    format Linux date Get-Date -UFormat
    %c Tue Nov 14 14:13:20 2023 Tue 14 Nov 2023 14:13:20
    %D 11/14/23 11-14-23
    %f 000000 f
    %U 46 45
    %W 46 45
    %x 11/14/23 11-14-23
    %Z -08 Z
    %z -0800 z
    %:z -08:00 :z
    %::z -08:00:00 ::z
    %:::z -08 :::z
  19. brianary commented on Nov 19, 2023

    @brianary
    Contributor

    It looks like %e also fails at times. Here are some examples of the 12 failing format specifiers:

    Some Get-Date -UnixTimeSeconds $Epoch -UFormat "%$Format" values
    that don't match date --date="@$Epoch" "+%$Format"
    Format Epoch DateTimeOffset Result Actual
    :::z 1193532346 10/27/2007 17:45:46 -07:00 -07 :::z
    :::z 1411440574 09/22/2014 19:49:34 -07:00 -07 :::z
    :::z 1133655724 12/03/2005 16:22:04 -08:00 -08 :::z
    :::z 1063344280 09/11/2003 22:24:40 -07:00 -07 :::z
    :::z 959191225 05/24/2000 11:00:25 -07:00 -07 :::z
    :::z 1368712450 05/16/2013 06:54:10 -07:00 -07 :::z
    :::z 1219137994 08/19/2008 02:26:34 -07:00 -07 :::z
    :::z 1675980226 02/09/2023 14:03:46 -08:00 -08 :::z
    :::z 1408200835 08/16/2014 07:53:55 -07:00 -07 :::z
    :::z 957408718 05/03/2000 19:51:58 -07:00 -07 :::z
    :::z 1393628515 02/28/2014 15:01:55 -08:00 -08 :::z
    :::z 947689501 01/12/2000 07:05:01 -08:00 -08 :::z
    :::z 1219515313 08/23/2008 11:15:13 -07:00 -07 :::z
    :::z 1065829381 10/10/2003 16:43:01 -07:00 -07 :::z
    :::z 1666846504 10/26/2022 21:55:04 -07:00 -07 :::z
    :::z 1396048561 03/28/2014 16:16:01 -07:00 -07 :::z
    :::z 1568184091 09/10/2019 23:41:31 -07:00 -07 :::z
    :::z 1468025413 07/08/2016 17:50:13 -07:00 -07 :::z
    :::z 1624235479 06/20/2021 17:31:19 -07:00 -07 :::z
    :::z 1596261829 07/31/2020 23:03:49 -07:00 -07 :::z
    ::z 1193532346 10/27/2007 17:45:46 -07:00 -07:00:00 ::z
    ::z 1411440574 09/22/2014 19:49:34 -07:00 -07:00:00 ::z
    ::z 1133655724 12/03/2005 16:22:04 -08:00 -08:00:00 ::z
    ::z 1063344280 09/11/2003 22:24:40 -07:00 -07:00:00 ::z
    ::z 959191225 05/24/2000 11:00:25 -07:00 -07:00:00 ::z
    ::z 1368712450 05/16/2013 06:54:10 -07:00 -07:00:00 ::z
    ::z 1219137994 08/19/2008 02:26:34 -07:00 -07:00:00 ::z
    ::z 1675980226 02/09/2023 14:03:46 -08:00 -08:00:00 ::z
    ::z 1408200835 08/16/2014 07:53:55 -07:00 -07:00:00 ::z
    ::z 957408718 05/03/2000 19:51:58 -07:00 -07:00:00 ::z
    ::z 1393628515 02/28/2014 15:01:55 -08:00 -08:00:00 ::z
    ::z 947689501 01/12/2000 07:05:01 -08:00 -08:00:00 ::z
    ::z 1219515313 08/23/2008 11:15:13 -07:00 -07:00:00 ::z
    ::z 1065829381 10/10/2003 16:43:01 -07:00 -07:00:00 ::z
    ::z 1666846504 10/26/2022 21:55:04 -07:00 -07:00:00 ::z
    ::z 1396048561 03/28/2014 16:16:01 -07:00 -07:00:00 ::z
    ::z 1568184091 09/10/2019 23:41:31 -07:00 -07:00:00 ::z
    ::z 1468025413 07/08/2016 17:50:13 -07:00 -07:00:00 ::z
    ::z 1624235479 06/20/2021 17:31:19 -07:00 -07:00:00 ::z
    ::z 1596261829 07/31/2020 23:03:49 -07:00 -07:00:00 ::z
    :z 1193532346 10/27/2007 17:45:46 -07:00 -07:00 :z
    :z 1411440574 09/22/2014 19:49:34 -07:00 -07:00 :z
    :z 1133655724 12/03/2005 16:22:04 -08:00 -08:00 :z
    :z 1063344280 09/11/2003 22:24:40 -07:00 -07:00 :z
    :z 959191225 05/24/2000 11:00:25 -07:00 -07:00 :z
    :z 1368712450 05/16/2013 06:54:10 -07:00 -07:00 :z
    :z 1219137994 08/19/2008 02:26:34 -07:00 -07:00 :z
    :z 1675980226 02/09/2023 14:03:46 -08:00 -08:00 :z
    :z 1408200835 08/16/2014 07:53:55 -07:00 -07:00 :z
    :z 957408718 05/03/2000 19:51:58 -07:00 -07:00 :z
    :z 1393628515 02/28/2014 15:01:55 -08:00 -08:00 :z
    :z 947689501 01/12/2000 07:05:01 -08:00 -08:00 :z
    :z 1219515313 08/23/2008 11:15:13 -07:00 -07:00 :z
    :z 1065829381 10/10/2003 16:43:01 -07:00 -07:00 :z
    :z 1666846504 10/26/2022 21:55:04 -07:00 -07:00 :z
    :z 1396048561 03/28/2014 16:16:01 -07:00 -07:00 :z
    :z 1568184091 09/10/2019 23:41:31 -07:00 -07:00 :z
    :z 1468025413 07/08/2016 17:50:13 -07:00 -07:00 :z
    :z 1624235479 06/20/2021 17:31:19 -07:00 -07:00 :z
    :z 1596261829 07/31/2020 23:03:49 -07:00 -07:00 :z
    c 1193532346 10/27/2007 17:45:46 -07:00 Sat Oct 27 17:45:46 2007 Sat 27 Oct 2007 17:45:46
    c 1411440574 09/22/2014 19:49:34 -07:00 Mon Sep 22 19:49:34 2014 Mon 22 Sep 2014 19:49:34
    c 1133655724 12/03/2005 16:22:04 -08:00 Sat Dec 3 16:22:04 2005 Sat 03 Dec 2005 16:22:04
    c 1063344280 09/11/2003 22:24:40 -07:00 Thu Sep 11 22:24:40 2003 Thu 11 Sep 2003 22:24:40
    c 959191225 05/24/2000 11:00:25 -07:00 Wed May 24 11:00:25 2000 Wed 24 May 2000 11:00:25
    c 1368712450 05/16/2013 06:54:10 -07:00 Thu May 16 06:54:10 2013 Thu 16 May 2013 06:54:10
    c 1219137994 08/19/2008 02:26:34 -07:00 Tue Aug 19 02:26:34 2008 Tue 19 Aug 2008 02:26:34
    c 1675980226 02/09/2023 14:03:46 -08:00 Thu Feb 9 14:03:46 2023 Thu 09 Feb 2023 14:03:46
    c 1408200835 08/16/2014 07:53:55 -07:00 Sat Aug 16 07:53:55 2014 Sat 16 Aug 2014 07:53:55
    c 957408718 05/03/2000 19:51:58 -07:00 Wed May 3 19:51:58 2000 Wed 03 May 2000 19:51:58
    c 1393628515 02/28/2014 15:01:55 -08:00 Fri Feb 28 15:01:55 2014 Fri 28 Feb 2014 15:01:55
    c 947689501 01/12/2000 07:05:01 -08:00 Wed Jan 12 07:05:01 2000 Wed 12 Jan 2000 07:05:01
    c 1219515313 08/23/2008 11:15:13 -07:00 Sat Aug 23 11:15:13 2008 Sat 23 Aug 2008 11:15:13
    c 1065829381 10/10/2003 16:43:01 -07:00 Fri Oct 10 16:43:01 2003 Fri 10 Oct 2003 16:43:01
    c 1666846504 10/26/2022 21:55:04 -07:00 Wed Oct 26 21:55:04 2022 Wed 26 Oct 2022 21:55:04
    c 1396048561 03/28/2014 16:16:01 -07:00 Fri Mar 28 16:16:01 2014 Fri 28 Mar 2014 16:16:01
    c 1568184091 09/10/2019 23:41:31 -07:00 Tue Sep 10 23:41:31 2019 Tue 10 Sep 2019 23:41:31
    c 1468025413 07/08/2016 17:50:13 -07:00 Fri Jul 8 17:50:13 2016 Fri 08 Jul 2016 17:50:13
    c 1624235479 06/20/2021 17:31:19 -07:00 Sun Jun 20 17:31:19 2021 Sun 20 Jun 2021 17:31:19
    c 1596261829 07/31/2020 23:03:49 -07:00 Fri Jul 31 23:03:49 2020 Fri 31 Jul 2020 23:03:49
    D 1193532346 10/27/2007 17:45:46 -07:00 10/27/07 10-27-07
    D 1411440574 09/22/2014 19:49:34 -07:00 09/22/14 09-22-14
    D 1133655724 12/03/2005 16:22:04 -08:00 12/03/05 12-03-05
    D 1063344280 09/11/2003 22:24:40 -07:00 09/11/03 09-11-03
    D 959191225 05/24/2000 11:00:25 -07:00 05/24/00 05-24-00
    D 1368712450 05/16/2013 06:54:10 -07:00 05/16/13 05-16-13
    D 1219137994 08/19/2008 02:26:34 -07:00 08/19/08 08-19-08
    D 1675980226 02/09/2023 14:03:46 -08:00 02/09/23 02-09-23
    D 1408200835 08/16/2014 07:53:55 -07:00 08/16/14 08-16-14
    D 957408718 05/03/2000 19:51:58 -07:00 05/03/00 05-03-00
    D 1393628515 02/28/2014 15:01:55 -08:00 02/28/14 02-28-14
    D 947689501 01/12/2000 07:05:01 -08:00 01/12/00 01-12-00
    D 1219515313 08/23/2008 11:15:13 -07:00 08/23/08 08-23-08
    D 1065829381 10/10/2003 16:43:01 -07:00 10/10/03 10-10-03
    D 1666846504 10/26/2022 21:55:04 -07:00 10/26/22 10-26-22
    D 1396048561 03/28/2014 16:16:01 -07:00 03/28/14 03-28-14
    D 1568184091 09/10/2019 23:41:31 -07:00 09/10/19 09-10-19
    D 1468025413 07/08/2016 17:50:13 -07:00 07/08/16 07-08-16
    D 1624235479 06/20/2021 17:31:19 -07:00 06/20/21 06-20-21
    D 1596261829 07/31/2020 23:03:49 -07:00 07/31/20 07-31-20
    e 1133655724 12/03/2005 16:22:04 -08:00 3 3
    e 1675980226 02/09/2023 14:03:46 -08:00 9 9
    e 957408718 05/03/2000 19:51:58 -07:00 3 3
    e 1468025413 07/08/2016 17:50:13 -07:00 8 8
    e 1473346912 09/08/2016 08:01:52 -07:00 8 8
    e 1281044332 08/05/2010 14:38:52 -07:00 5 5
    e 1173183142 03/06/2007 04:12:22 -08:00 6 6
    e 1218188191 08/08/2008 02:36:31 -07:00 8 8
    e 1194286984 11/05/2007 10:23:04 -08:00 5 5
    e 1065400018 10/05/2003 17:26:58 -07:00 5 5
    e 1367554471 05/02/2013 21:14:31 -07:00 2 2
    e 1625679700 07/07/2021 10:41:40 -07:00 7 7
    e 1368048889 05/08/2013 14:34:49 -07:00 8 8
    e 1354608526 12/04/2012 00:08:46 -08:00 4 4
    e 1285962490 10/01/2010 12:48:10 -07:00 1 1
    e 1007605156 12/05/2001 18:19:16 -08:00 5 5
    e 1070435275 12/02/2003 23:07:55 -08:00 2 2
    e 1507227556 10/05/2017 11:19:16 -07:00 5 5
    e 1446544252 11/03/2015 01:50:52 -08:00 3 3
    e 1002140536 10/03/2001 13:22:16 -07:00 3 3
    f 1193532346 10/27/2007 17:45:46 -07:00 %f f
    f 1411440574 09/22/2014 19:49:34 -07:00 %f f
    f 1133655724 12/03/2005 16:22:04 -08:00 %f f
    f 1063344280 09/11/2003 22:24:40 -07:00 %f f
    f 959191225 05/24/2000 11:00:25 -07:00 %f f
    f 1368712450 05/16/2013 06:54:10 -07:00 %f f
    f 1219137994 08/19/2008 02:26:34 -07:00 %f f
    f 1675980226 02/09/2023 14:03:46 -08:00 %f f
    f 1408200835 08/16/2014 07:53:55 -07:00 %f f
    f 957408718 05/03/2000 19:51:58 -07:00 %f f
    f 1393628515 02/28/2014 15:01:55 -08:00 %f f
    f 947689501 01/12/2000 07:05:01 -08:00 %f f
    f 1219515313 08/23/2008 11:15:13 -07:00 %f f
    f 1065829381 10/10/2003 16:43:01 -07:00 %f f
    f 1666846504 10/26/2022 21:55:04 -07:00 %f f
    f 1396048561 03/28/2014 16:16:01 -07:00 %f f
    f 1568184091 09/10/2019 23:41:31 -07:00 %f f
    f 1468025413 07/08/2016 17:50:13 -07:00 %f f
    f 1624235479 06/20/2021 17:31:19 -07:00 %f f
    f 1596261829 07/31/2020 23:03:49 -07:00 %f f
    U 1411440574 09/22/2014 19:49:34 -07:00 38 37
    U 959191225 05/24/2000 11:00:25 -07:00 21 20
    U 1675980226 02/09/2023 14:03:46 -08:00 06 5
    U 957408718 05/03/2000 19:51:58 -07:00 18 17
    U 1393628515 02/28/2014 15:01:55 -08:00 08 8
    U 947689501 01/12/2000 07:05:01 -08:00 02 1
    U 1666846504 10/26/2022 21:55:04 -07:00 43 42
    U 1624235479 06/20/2021 17:31:19 -07:00 25 24
    U 1105994338 01/17/2005 12:38:58 -08:00 03 2
    U 1211773768 05/25/2008 20:49:28 -07:00 21 20
    U 1442185567 09/13/2015 16:06:07 -07:00 37 36
    U 1099228618 10/31/2004 05:16:58 -08:00 44 43
    U 1173183142 03/06/2007 04:12:22 -08:00 09 9
    U 1065400018 10/05/2003 17:26:58 -07:00 40 39
    U 1611315556 01/22/2021 03:39:16 -08:00 03 3
    U 1011222214 01/16/2002 15:03:34 -08:00 02 2
    U 1014149689 02/19/2002 12:14:49 -08:00 07 7
    U 1625679700 07/07/2021 10:41:40 -07:00 27 26
    U 1677411436 02/26/2023 03:37:16 -08:00 09 8
    U 1354608526 12/04/2012 00:08:46 -08:00 49 48
    W 1193532346 10/27/2007 17:45:46 -07:00 43 42
    W 1411440574 09/22/2014 19:49:34 -07:00 38 37
    W 959191225 05/24/2000 11:00:25 -07:00 21 20
    W 1675980226 02/09/2023 14:03:46 -08:00 06 5
    W 957408718 05/03/2000 19:51:58 -07:00 18 17
    W 1393628515 02/28/2014 15:01:55 -08:00 08 8
    W 947689501 01/12/2000 07:05:01 -08:00 02 1
    W 1666846504 10/26/2022 21:55:04 -07:00 43 42
    W 1105994338 01/17/2005 12:38:58 -08:00 03 2
    W 1173183142 03/06/2007 04:12:22 -08:00 10 9
    W 1530204982 06/28/2018 09:56:22 -07:00 26 25
    W 1194286984 11/05/2007 10:23:04 -08:00 45 44
    W 1611315556 01/22/2021 03:39:16 -08:00 03 3
    W 1011222214 01/16/2002 15:03:34 -08:00 02 2
    W 1014149689 02/19/2002 12:14:49 -08:00 07 7
    W 1625679700 07/07/2021 10:41:40 -07:00 27 26
    W 1187443198 08/18/2007 06:19:58 -07:00 33 32
    W 1677411436 02/26/2023 03:37:16 -08:00 08 8
    W 1354608526 12/04/2012 00:08:46 -08:00 49 48
    W 1495101304 05/18/2017 02:55:04 -07:00 20 19
    x 1193532346 10/27/2007 17:45:46 -07:00 10/27/07 10-27-07
    x 1411440574 09/22/2014 19:49:34 -07:00 09/22/14 09-22-14
    x 1133655724 12/03/2005 16:22:04 -08:00 12/03/05 12-03-05
    x 1063344280 09/11/2003 22:24:40 -07:00 09/11/03 09-11-03
    x 959191225 05/24/2000 11:00:25 -07:00 05/24/00 05-24-00
    x 1368712450 05/16/2013 06:54:10 -07:00 05/16/13 05-16-13
    x 1219137994 08/19/2008 02:26:34 -07:00 08/19/08 08-19-08
    x 1675980226 02/09/2023 14:03:46 -08:00 02/09/23 02-09-23
    x 1408200835 08/16/2014 07:53:55 -07:00 08/16/14 08-16-14
    x 957408718 05/03/2000 19:51:58 -07:00 05/03/00 05-03-00
    x 1393628515 02/28/2014 15:01:55 -08:00 02/28/14 02-28-14
    x 947689501 01/12/2000 07:05:01 -08:00 01/12/00 01-12-00
    x 1219515313 08/23/2008 11:15:13 -07:00 08/23/08 08-23-08
    x 1065829381 10/10/2003 16:43:01 -07:00 10/10/03 10-10-03
    x 1666846504 10/26/2022 21:55:04 -07:00 10/26/22 10-26-22
    x 1396048561 03/28/2014 16:16:01 -07:00 03/28/14 03-28-14
    x 1568184091 09/10/2019 23:41:31 -07:00 09/10/19 09-10-19
    x 1468025413 07/08/2016 17:50:13 -07:00 07/08/16 07-08-16
    x 1624235479 06/20/2021 17:31:19 -07:00 06/20/21 06-20-21
    x 1596261829 07/31/2020 23:03:49 -07:00 07/31/20 07-31-20
    Z 1193532346 10/27/2007 17:45:46 -07:00 PDT -07
    z 1193532346 10/27/2007 17:45:46 -07:00 -0700 z
    z 1411440574 09/22/2014 19:49:34 -07:00 -0700 z
    Z 1411440574 09/22/2014 19:49:34 -07:00 PDT -07
    Z 1133655724 12/03/2005 16:22:04 -08:00 PST -08
    z 1133655724 12/03/2005 16:22:04 -08:00 -0800 z
    Z 1063344280 09/11/2003 22:24:40 -07:00 PDT -07
    z 1063344280 09/11/2003 22:24:40 -07:00 -0700 z
    z 959191225 05/24/2000 11:00:25 -07:00 -0700 z
    Z 959191225 05/24/2000 11:00:25 -07:00 PDT -07
    z 1368712450 05/16/2013 06:54:10 -07:00 -0700 z
    Z 1368712450 05/16/2013 06:54:10 -07:00 PDT -07
    Z 1219137994 08/19/2008 02:26:34 -07:00 PDT -07
    z 1219137994 08/19/2008 02:26:34 -07:00 -0700 z
    Z 1675980226 02/09/2023 14:03:46 -08:00 PST -08
    z 1675980226 02/09/2023 14:03:46 -08:00 -0800 z
    z 1408200835 08/16/2014 07:53:55 -07:00 -0700 z
    Z 1408200835 08/16/2014 07:53:55 -07:00 PDT -07
    z 957408718 05/03/2000 19:51:58 -07:00 -0700 z
    Z 957408718 05/03/2000 19:51:58 -07:00 PDT -07
  20. brianary commented on Nov 20, 2023

    @brianary
    Contributor
    • %c differs by the order of the fields; it doesn't match the POSIX format, but since this format is defined as "The preferred date and time representation for the current locale", there may be some flexibility there.
    • %D and %x differ only by the date separator, which could be due to Windows locale settings. The former indicates a specific separator to use, so it should be changed from using the user-preferred separator to the fixed one. Since the latter is defined as "Locale’s appropriate date representation", there may be some flexibility for that one.
    • %e looks fine; the leading space seems to have confused some testing.
    • %f isn't a format character.
    • %U and %W week numbers seem to be off by one for many (all?) dates. These are the only ones providing numerically incorrect data.
    • %Z %z %:z %::z %:::z the time zone formats all need work, though %Z is "The timezone name or abbreviation", which suggests some flexibility. The rest are unimplemented.
  21. microsoft-github-policy-service commented on Nov 27, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

  22. added 2 commits that reference this issue on Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreWG-Cmdletsgeneral cmdlet issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions