[SERVER-28610] Add time zone support, and %z and %Z arguments to the $dateToString operator Created: 04/Apr/17  Updated: 28/Apr/23  Resolved: 12/Jul/17

Status: Closed
Project: Core Server
Component/s: Aggregation Framework, Querying
Affects Version/s: None
Fix Version/s: 3.5.10

Type: Task Priority: Major - P3
Reporter: Ian Whalen (Inactive) Assignee: Derick Rethans
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-28612 Expand timelib library to take a conf... Closed
Documented
is documented by DOCS-10526 Docs for SERVER-28610: Add %z argumen... Closed
Related
is related to SERVER-76696 $dateToString aggregation with timezo... Closed
Backwards Compatibility: Fully Compatible
Sprint: Query 2017-07-31
Participants:

 Description   

The $dateToString operator is extended with the timezone argument. Its full new syntax is now:

    { $dateToString: {
        format: formatString,
        date: dateExpression,
        timezone: timeZoneIdentifier
    } }

The timezone argument is optional. The "timezone" argument is optional, and must evaluate to specify an Olson Timezone Identifier such as "Europe/London" or "America/New_York", or, a UTC offset string in the forms: "+03", "-0530", and "+04:45". If present, it formats the string according to the given time zone, otherwise it uses UTC.

The $dateToString format arguments have also been expanded. With the addition of the timezone argument came the %z and %Z format specifiers:

%z
The +hhmm or -hhmm numeric timezone as a string (that is, the hour and minute offset from UTC). Example: ``+0445``, ``-0500``

%Z
The minutes offset from UTC as a number. Example (following the ``+0445`` and ``-0500`` from %z): ``+285``, ``-300``



 Comments   
Comment by Githook User [ 12/Jul/17 ]

Author:

{u'username': u'derickr', u'name': u'Derick Rethans', u'email': u'github@derickrethans.nl'}

Message: SERVER-28610 Added timezone support (and %z and %Z) to $dateToString
Branch: master
https://github.com/mongodb/mongo/commit/c92d85fea435f64aedec07a2b42cbc16833ede82

Generated at Thu Feb 08 04:18:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.