Articles → MONGODB → Date And Timestamp Function In Mongodb

Date And Timestamp Function In Mongodb






Purpose





Example




db.DateTimeCollection.insertOne({
  Date: new Date(),
  Time: new Timestamp()
})


Picture showing inserting the date and time using the Date and Timestamp function




Picture showing the value of date and time field inserted earlier




Picture showing the output of the getTimestamp() function





Posted By  -  Karan Gupta
 
Posted On  -  Monday, April 3, 2023

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250