Hierarchy

  • DateDiff

Properties

Properties

$dateDiff: {
    endDate: DateExpression;
    startDate: DateExpression;
    startOfWeek?: StringExpression<StartOfWeek>;
    timezone?: tzExpression;
    unit: StringExpression<DateUnit>;
}

Returns the difference between two dates.

Type declaration

  • endDate: DateExpression

    The end of the time period. The endDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID.

  • startDate: DateExpression

    The start of the time period. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID.

  • Optional startOfWeek?: StringExpression<StartOfWeek>

    Used when the unit is equal to week. Defaults to Sunday. The startOfWeek parameter is an expression that resolves to a case insensitive string:

    • monday (or mon)
    • tuesday (or tue)
    • wednesday (or wed)
    • thursday (or thu)
    • friday (or fri)
    • saturday (or sat)
    • sunday (or sun)
  • Optional timezone?: tzExpression

    The timezone to carry out the operation. 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.

  • unit: StringExpression<DateUnit>

    The time measurement unit between the startDate and endDate. It is an expression that resolves to a string:

    • year
    • quarter
    • week
    • month
    • day
    • hour
    • minute
    • second
    • millisecond

Generated using TypeDoc