When a user selects a date on the client side using a date picker, I need to send it to the server and use UTC value for future calculations. For example, if the user chooses "Tue Oct 04 2011 00:00:00 GMT+0300 (E. Europe Daylight Time)," I send milliseconds to the server using "date.getTime()." On the server, I have a method:
public static DateTime GetDateByMilliseconds(long milliseconds)
{
var date = new DateTime(1970, 1, 1);
return date.AddMilliseconds(milliseconds);
}
The result I get is "Oct 03, 2011 09:00:00 PM," but what I actually want to work with is "Oct 04 2011 00:00:00." Do I need to reset the date timezone on the client side or add an offset on the server? Is there anything else I should consider?