Skip to main content

$day

The $day operator extracts the day component from a date object (1-31).

Input

  • A single date object

Output

  • The day component of the date as an integer (1-31)

Examples

Extract Day from Date

{
  "$day": [
    {
      "$toDate": ["2023-01-15T10:30:00Z"]
    }
  ]
}
Result: 15

Extract Day from Field

{
  "$day": [
    {
      "$input": "event_date"
    }
  ]
}
Result: The day component (1-31) of the event_date field