views:

25

answers:

1

Hi All,

I am having an issues passing a JSON containing DateTime to asp.net code-behind (c#).

If the client browser is in the same timezone as the server I have no issue, but if they are in different timezones my time is getting modified by the offset value of the two timezones.

But all my datetimes need to be the date with a time of 00:00, regardless of the time zone this datetime comes from.

Thanks

A: 

If you want the client and the server to share the same relative time like that, have the client pass back a string describing the date in some easy-to-parse format. Then your server code can parse that string as if it's local time.

Alternatively you could have everything work in UTC time.

You have to be careful with things like this of course. For example, if the client is expecting to schedule some activity to take place at the server, then the server's midnight may not be the same as the midnight at the client. The client therefore needs to make it clear that the time setting is for the server's time zone.

Pointy