MongoDB aggregation: How to convert ticks to Date?

Viewed 116

How can I convert the following date which is represented in ticks to a Date object in MongoDb aggregation?

{ "MyDateInTicks" : 637589210301409000 }

I tried this but no luck:

$project : { "ConvertedDate": { $toDate: "$MyDateInTicks" } }

The error message is:

Error parsing date string '637589210301408968'; 16: Unexpected character '6'; 17: Unexpected character '8'

0 Answers
Related