Hierarchy

  • DateSubtract

Properties

Properties

$dateSubtract: {
    amount: NumberExpression;
    startDate: DateExpression;
    timezone?: tzExpression;
    unit: StringExpression<DateUnit>;
}

Subtracts a number of time units from a date object.

Type declaration

  • amount: NumberExpression

    The number of units subtracted from the startDate. The amount is an expression that resolves to an integer or long. The amount can also resolve to an integral decimal and or a double if that value can be converted to a long without loss of precision.

  • startDate: DateExpression

    The beginning date, in UTC, for the subtraction operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID.

  • 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 unit of time, specified as an expression that must resolve to one of these strings:

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

    Together, binSize and unit specify the time period used in the $dateTrunc calculation.

Generated using TypeDoc