MongoDb: Convert date string to specific format in mongodb 3.6
问题 I need to parse date value to specific format without using format field in dateFromString operator. Mongo Playground Current situation : in Mongodb 4.0 if I format dateString using below it code it give me mentioned output. parsedDate: { $dateFromString: { dateString: "$dateS", format: format: "%Y-%m-%dT%H" } } Output: "parsedDate": ISODate("2020-01-16T08:00:00Z") I cannot use format field in 3.6 since its not supported. How do I convert my date to format: "%Y-%m-%dT%H" in 3.6? 回答1: If I get