Hierarchy

  • DateToString

Properties

Properties

$dateToString: {
    date: DateExpression;
    format?: string;
    onNull?: any;
    timezone?: tzExpression;
}

Returns the date as a formatted string.

Type declaration

  • date: DateExpression

    The date to convert to string. must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID.

  • Optional format?: string

    The date format specification. can be any string literal, containing 0 or more format specifiers. For a list of specifiers available, see Format Specifiers.

    If unspecified, $dateToString uses "%Y-%m-%dT%H:%M:%S.%LZ" as the default format.

    Changed in version 4.0: The format field is optional if featureCompatibilityVersion (fCV) is set to "4.0" or greater. For more information on fCV, see setFeatureCompatibilityVersion.

  • Optional onNull?: any

    The value to return if the date is null or missing. The arguments can be any valid expression.

    If unspecified, $dateToString returns null if the date is null or missing.

    Changed in version 4.0: Requires featureCompatibilityVersion (fCV) set to "4.0" or greater. For more information on fCV, see setFeatureCompatibilityVersion.

  • Optional timezone?: tzExpression

    The timezone of the operation result. must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC.

    Version

    3.6

Generated using TypeDoc