node.js - Javascript Date inconsistency -
on node server, receive time value client in epoch format (milliseconds since jan 1 1970). feed date()
object , print so:
var d = new date(epochtime); var year = d.getfullyear(); var mo = d.getmonth(); var day = d.getday(); console.log("iso:" + d.toisostring() + " year:" + year + " mo:" + mo + " day:" + day);
now, weird inconsistency date object. e.g. value of "1437386620207.58" - above console.log
prints:
iso:2015-07-20t10:03:40.207z year:2015 mo:6 day:1
huh? why dates different?
two problems in code:
Comments
Post a Comment