简体   繁体   English

猫鼬-如何阅读和比较在时间戳创建的猫鼬

[英]Mongoose - How to read and compare mongoose createdAt timestamp

Mongoose timestamp option restore createdAt information like 2017-12-10T04:22:43.660Z which I can't read into Date . 创建了猫鼬时间戳选项还原在2017-12-10T04:22:43.660Z ,我无法读入Date What should I do to this information so that I can compare two timestamps to determine which one is created ealier. 我应该如何处理此信息,以便可以比较两个时间戳,以确定哪个时间戳更美观。

Try using Date.Parse("put the timestamp here") it should work. 尝试使用Date.Parse(“将时间戳记放在此处”)可以正常工作。 If not, try to define the time format and then parse it out. 如果不是,请尝试定义时间格式,然后解析出来。 That will work. 那可行。

Example of usage: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse 使用示例: https : //developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Date/parse

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM