I have Date on client side (user choose it in date picker) and I want to send it to server and use UTC value for future calculations.
For example, user chooses Tue Oct 04 2011 00:00:00 GMT+0300 (E. Europe Daylight Time), I send milliseconds to server using date.getTime(). On server I use method:
public static DateTime GetDateByMilliseconds(long milliseconds)
{
var date = new DateTime(1970, 1, 1);
return date.AddMilliseconds(milliseconds);
}
And get Oct 03, 2011 09:00:00 PM. But I want to operate with value Oct 04 2011 00:00:00.
What should I do? Reset date timezone on client side? Add offset on server? Anything else?
I think you should do:
This will “remove” the offset for the user timezone.