MongoDB $dateFromString Format Specifiers

The following table outlines the format specifiers that can be used with the $dateFromString aggregation pipeline operator in MongoDB.

SpecifiersDescriptionPossible Values
%dDay of Month (2 digits, zero padded)0131
%GYear in ISO 8601 format00009999
%HHour (2 digits, zero padded, 24-hour clock)0023
%LMillisecond (3 digits, zero padded)000999
%mMonth (2 digits, zero padded)0112
%MMinute (2 digits, zero padded)0059
%SSecond (2 digits, zero padded)0060
%uDay of week number in ISO 8601 format (1-Monday, 7-Sunday)17
%VWeek of Year in ISO 8601 format153
%YYear (4 digits, zero padded)00009999
%zThe timezone offset from UTC.+/-[hh][mm]
%ZThe minutes offset from UTC as a number. For example, if the timezone offset (+/-[hhmm]) was +0445, the minutes offset is +285.+/-mmm
%%Percent Character as a Literal%

The above table is based on the table from the MongoDB documentation for the $dateFromString operator.