0

Often I enter a filed createdAt = new Date() in the Meteor collections, which looks like this

"createdAt" : ISODate("2016-03-03T10:00:49.192Z")

Wouldn't it be easer for sorting if the formate is the number of seconds since 1970 instead? and if so, what is the efficient way to insert such formate instead of converting the current formate? thanks

edited After Salman solution, I tried to apply the "same" idea for no avail.

In the browser console,

x
Object {_id: "m3FMayA33R4Y2FgbD", action: "ation1", createdAt: Thu Mar 03 2016 22:00:36 GMT+1100 (AEDT)}
x._id.getTimestamp
undefined
Fred J.
  • 5,759
  • 10
  • 57
  • 106

1 Answers1

0

Try moment js to format date time. :)