function SQLServerDateTojsDateTime(a) { return Math.ceil((a * 86400 - 2208988800) * 1000); }An example of its use (from a jscli session):
> d = new Date() Thu Sep 17 12:03:58 UTC+0800 2015 > d.valueOf() 1442462638627 > n = jsDateTimeToSQLServerDateTime(d) 42262.169428553236 > m = SQLServerDateTojsDateTime(n) 1442462638627 > new Date(m) Thu Sep 17 12:03:58 UTC+0800 2015Enjoy!
© Copyright Bruce M. Axtens, 2015
No comments:
Post a Comment