Oops, my mistake, the problem I have isn't on the C# side (the SpecifyKind function does what I want it to do), it's on the javascript side. I need to somehow create a javascript Date object similar to how I described C#'s SpecifyKind function works.
Since I'm dealing with JSON, I need javascript that will create a Date object in the UTC timezone from a given "milliseconds since epoch" value. The problem is that javascript dates automatically convert a UTC datetime value to a local timezone value.
Hopefully this code and comments will explain the problem:
// 1335834000000 = Tue, 01 May 2012 01:00:00 GMT
// The following javascript running on my laptop in California will produce a Date object with a value of
// Mon Apr 30 2012 18:00:00 GMT-0700 (Pacific Daylight Time)
var dt = new Date(1335834000000);
// I need something like this that produces the original UTC time of
// Tue, 01 May 2012 01:00:00 GMT
redwing19
Member
400 Points
180 Posts
Re: DateTime issues with Azure c#, javascript, sql....so confused.
May 29, 2012 11:36 PM|LINK
Oops, my mistake, the problem I have isn't on the C# side (the SpecifyKind function does what I want it to do), it's on the javascript side. I need to somehow create a javascript Date object similar to how I described C#'s SpecifyKind function works.
Since I'm dealing with JSON, I need javascript that will create a Date object in the UTC timezone from a given "milliseconds since epoch" value. The problem is that javascript dates automatically convert a UTC datetime value to a local timezone value.
Hopefully this code and comments will explain the problem:
// 1335834000000 = Tue, 01 May 2012 01:00:00 GMT
// The following javascript running on my laptop in California will produce a Date object with a value of
// Mon Apr 30 2012 18:00:00 GMT-0700 (Pacific Daylight Time)
var dt = new Date(1335834000000);
// I need something like this that produces the original UTC time of
// Tue, 01 May 2012 01:00:00 GMT
var dt = new Date(1335834000000, "UTC")