views:

160

answers:

1

I'm building the JSON string "by hand" server-side.

Should I Convert.ToString(System.DateTime.Milliseconds) on the server-side and use javascript Date.setTime(milliseconds) on the client side?

+3  A: 

Using milliseconds I believe is your best bet, as it leads to the simplest conversion. One issue that you want to be careful about though is the fact that clocks may be in different timezones, so you may need to be aware of that, and perhaps send the time in some known standard timezone.

If you just need to display then you can send the date as a string, but that will make it harder to shift for a timezone change.

The best solution will depend on how it will be used and your needs.

James Black