AJAX Web Applications and Time Zones
Because I'm currently playing with a lot of AJAX frameworks I'm searching for the correct use of dates and times in web applications. Ajax.NET Professional is using time zone indentifier to know from which time zone the request is comming from. See following server-side C# code:
[AjaxMethod]
public static DateTime GetCurrentTime()
{
return DateTime.Now;
}
Calling this method should return the same date as calling new Date() on the client-side JavaScript code (with the difference of the request duration). Atlas is not returning the time zone which will end in a different time when calling above method.
How does this effect web farms where one of the web server is running in a different time zone, is this possible? And, when I look at DNS configuration of some A records I see that there are multiple IP addresses defined. When the web servers for each IP address is located in a different time zone you will have the same problem when dates do not include time zones.
What do you think is the right way? New Example available at http://berlin.schwarz-interactive.de/.
3 Comments
Comments have been disabled for this content.
Rama Krishna Vavilala said
The way atlas works is that it serializes and deserializes the milliseconds from 1/1/1970 midnight. This will ensure that the date time is correct and is independent of the timezones both on the server and the browser.
Marco said
What information are you using to convert the server date to client date? ps i think you should have some option to override this default behaviour, sometimes you want to show the server time Thanks Marco
Server method undenfined! said
web.config: Page_Load: AjaxPro.Utility.RegisterTypeForAjax(typeof(ServerNamespace.ServerClass)); server method: [AjaxPro.ajaxMethod()] ..... Client: ServerNamespace.ServerClass.ServerMethod(...,callback_stringvalue) The IE6.0 error: "ServerNamespace underfinded!" please tell me why? E-mail:rainnight850713@sina.com