[SERVER-28611] Add the tzExpression argument to the date extraction functions Created: 04/Apr/17  Updated: 06/Dec/17  Resolved: 07/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: Charlie Swanson
Resolution: Done Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-465 date matcher helpers Closed
Documented
is documented by DOCS-10525 Docs for SERVER-28611: Add the tzExpr... Closed
Backwards Compatibility: Minor Change
Sprint: Query 2017-06-19, Query 2017-07-10
Participants:

 Description   

The new functionality adds the timezone argument to the date extraction functions ($year, $month, $day, $hour, $minute, $second, $millisecond, $isoYear, $isoWeekYear, and $isoDayOfWeek). Currently the operators only take a single value:

    { "$month" : ISODateValue }

Because it is not possible to add another argument to this, the syntax has
been extended to:

    { "$month" : { "date" : ISODateValue } }

And then with the time zone argument added, it becomes:

    { "$month" : {
        "date" : ISODateValue,
        "timezone": timeZoneIdentifier
    } }

For example:

    { $hour: {
        date: ISODate("1978-12-22T08:15:00Z"),
        timezone: "Europe/Amsterdam"
    } }

Would return 09 (One hour later than UTC).

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 you specify a timezone argument it means that the dateString that you provided will be interpreted as it was in that time zone.



 Comments   
Comment by Charlie Swanson [ 07/Jul/17 ]

Author:

{u'username': u'cswanson310', u'name': u'Charlie Swanson', u'email': u'charlie.swanson@mongodb.com'}

Message: ERVER-28611 Add timezone argument for date expressions
Branch: master
https://github.com/mongodb/mongo/commit/56c8b7660fd85c02b5a8ade15e1dfdb49cbfea46

Comment by Charlie Swanson [ 07/Jul/17 ]

Committed in 56c8b7660fd85c02b5a8ade15e1dfdb49cbfea46, I goofed the commit message so it didn't get a comment here.

Comment by Githook User [ 15/Jun/17 ]

Author:

{u'username': u'cswanson310', u'name': u'Charlie Swanson', u'email': u'charlie.swanson@mongodb.com'}

Message: SERVER-28611 Use UTC TimeZone class for date expressions.
Branch: master
https://github.com/mongodb/mongo/commit/9822df6e71b0c5793676f9358e5d212c103c19a7

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