MongoDB Date Operators
MongoDB date operators are a set of special operators used for handling date type fields. They can be used for formatting, converting, and comparing dates in both aggregation and regular queries. This page summarizes the date operators available in MongoDB.
- 
            
$dateFromParts
$dateFromPartsis a date operator in MongoDB that can be used to combine the given date components (such as year, month, day, etc.) into a date object. - 
            
$dateFromString
$dateFromStringis a MongoDB aggregation operator used to convert a string into a date object. - 
            
$dateToParts
The MongoDB$dateToPartsoperator can convert dates to corresponding parts such as year, month, day, etc., to enable more flexible data processing and aggregation operations. - 
            
$dateToString
The MongoDB$dateToStringoperator is used to convert a date field to a string and format the date into a specified string format. - 
            
$dayOfMonth
The MongoDB$dayOfMonthoperator is an aggregation expression used to extract the day of the month (1-31) from a date field. - 
            
$dayOfWeek
$dayOfWeekis an aggregation operator in MongoDB used to extract the day of the week information from a date value. - 
            
$dayOfYear
The$dayOfYearoperator is one of the date operators in MongoDB’s aggregation pipeline. - 
            
$hour
The MongoDB$houroperator is an aggregation operator used to extract the hour portion from a datetime value. - 
            
$isoDayOfWeek
The MongoDB$isoDayOfWeekoperator is an aggregation operator used to extract the day of the week in ISO standard from a date-time value. - 
            
$isoWeek
The MongoDB$isoWeekoperator can be used to process and filter date data. - 
            
$isoWeekYear
In MongoDB,$isoWeekYearis an aggregation operator used to retrieve the year of an ISO week date. - 
            
$millisecond
In MongoDB, the$millisecondoperator is used to extract the millisecond portion from a date. - 
            
$minute
The$minuteoperator is a date operator in MongoDB used to extract the minute portion from a date. - 
            
$month
$monthoperator is a date operator in MongoDB aggregation pipeline, which extracts the month from a date field and can be used in aggregation operations. - 
            
$second
$secondis one of the date operators in MongoDB used to handle datetime types. - 
            
$week
In MongoDB, the$weekoperator can be used to extract the week number from a date field. - 
            
$year
The$yearoperator is one of the operators used to manipulate date-time types and extract the year from a date-time field. - 
            
Date()
In MongoDB, theDate()method can be used to create a JavaScript Date object that represents a date and time.