-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
QE 2023-03-06, QE 2023-03-20, QE 2023-04-03
When I specify both %j for day of year and %m for month {'$dateFromString': {'dateString': '2007-01-11', 'format': '%Y-%j-%m'}} (note the order), the result is 2007-11-02T00:00:00.000Z - $j is treated like $d (but with an initial value of 0).
If I specify %Y-%j-%m-%d (input 2007-01-11-05), %j is ignored, and the result is 2007-11-05T00:00:00.000Z.
The strings "%Y-%m-%d-%j" and "%Y-%j-%m-%d" give different results for the same (re-ordered) values.
Since it is always an error to specify a day of year together with either a month or day of month, I would expect an error (similar to how we treat potentially incompatible timezones).
- related to
-
SERVER-50336 $dateFromString support for additional format specifiers (such as "%j" for day of year)
- Closed