DateTime JavaScript vs C# -


Despite the many posts I have still read the magic in my code I have DB ('2011-03-30 00: 00 : 00.000 ') has the date value of the date that I recover for the asp.net/mvc page where some javascript is reading and comparing it. Magic in the following:

  & lt;% date time UNIX time = new date (19, 1, 1, 0, 0, 0, 0); DateTime testdate = new date time (2011,03,30,0,0,0,0,0,0,0,0,0,0); & Gt%; & Lt;% = (testDate - unixTimeOffset) Total emyliseconds% & gt; ...   

The last string of code gives me this value: 1301443200000 When I try to read it in JavaScript: date val myDate = new Date (1301443200000);

and myDate March 29 2011 20:00:00 GMT-0400 (Eastern Daylight Time) {} but should not be until March 30.

I think this local time refers to GMT-4, but what is the solution to get it independent? any idea? Thank you.

Your code is correct myDate variable holds the correct date because Tuesday March 29 2011 20:00 GMT -400 as the time of the same time Mercury March 30, 2011 00: 00:00 GMT + 0000 My guess is that you are old Use myDate.toUTCString () to see the date as UTC as your computer has time zone.

Comments