I'm trying to import an old sqlite database to mongodb using node, this db has several date fields and I can't get the correct data, for example:
370735200 -> Should be 2012/10/01 00:00:00 but it shows:
Wed Sep 30 1981 23:00:00 GMT+0100 (CEST)
I'm doing this:
var originalDate = Math.round (new Date(data.origDate * 1000))
Another example 360540000 -> Should be 2012/06/05 00:00:00 but it shows:
Fri Jun 05 1981 00:00:00 GMT+0200 (CEST)
The date fields in SQLite db have the type: timestamp
Maybe somebody could advise or suggest some node module to deal with this.
Edited, adding info:
I was told that the sqlite value comes from NSDate, I saw the docs:The sole primitive method of NSDate, "timeIntervalSinceReferenceDate, provides the basis for all the other methods in the NSDate interface. This method returns a time value relative to an absolute reference date—the first instant of 1 January 2001, GMT." But I still wonder how can I translate that to get the correct date.