Skip to content

Get-Date: format option for ISO 8601 in UTC #11410

Closed

Description

@OneCyrus

Summary of the new feature/enhancement

Get-Date should support ISO 8601 to return in UTC. Currently the -format s option returns in ISO 8601 but local time.
There should be a new option which formats including the timezone.

e.g. instead of 2019-12-20T08:48:05 in UTC +1, it should be 2019-12-20T07:48:05Z

https://tools.ietf.org/html/rfc3339#section-5.8

Proposed technical implementation details (optional)

Activity

  1. added
    Issue-Enhancement
    on Dec 20, 2019
  2. jhoneill commented on Dec 20, 2019

    @jhoneill

    S is a short cut for "SortableDateTimePattern" which is defined in the current culture.
    It is equivalent to adding .tostring((Get-Culture).DateTimeFormat.SortableDateTimePattern)

    The .Net formatter seems to do some odd things. e.g. [datetime]::now.tostring("r") Will append "GMT" to the converted date time regardless of the timezone it came from

    [datetime]::now.tostring("HH:mm zzz") returns the offset information, e.g. 13:25 +01:00

    But the formatter doesn't seem to have a method for converting local time to universal time or vice versa. It needs to be done before the formatting is applied.
    [datetime]::now.ToUniversalTime().tostring("HH:mm zzz")

    Ideally Get-Date would have -UniversalTime as a switch.

  3. iSazonov commented on Dec 20, 2019

    @iSazonov
    Collaborator

    There is Get-Date -Format FileDateTimeUniversal.

    The switch could be -AsUTC.

  4. added
    First-Time-Issue
    Up-for-Grabs
    on Dec 20, 2019
  5. jackdcasey commented on Jan 16, 2020

    @jackdcasey
    Contributor

    I'd be happy to take this one on!

  6. OneCyrus commented on Jan 25, 2020

    @OneCyrus
    Author

    awesome! thank you Brendan Burns (@brendandburns)!

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

    First-Time-IssueIssue-EnhancementResolution-FixedUp-for-GrabsWG-Cmdlets

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions