I have been reading that if you want to convert from JavaScript dates to C# dates you should use getTime() and then add that result to a C# DateTime.
Suppose I have this JavaScript time:
Date {Tue Jul 12 2011 16:00:00 GMT-0700 (Pacific Daylight Time)}
It renders to 1310522400000 milliseconds
var a = new DateTime(1970, 01, 01).AddMilliseconds(1310522400000);
// result
7/13/2011 2:00:00 AM
So this is wrong. I am not sure what I need to do.
First create a string in your required format using the following functions in JavaScript
Pass this string to codebehind function and accept it as a string parameter.Use the
DateTime.ParseExact()in codebehind to convert this string toDateTimeas follows,Hope this helps…