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/.

Published Friday, July 07, 2006 12:50 PM by Michael Schwarz

Comments

# re: AJAX Web Applications and Time Zones

Friday, July 07, 2006 9:34 AM by Rama Krishna Vavilala
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.

# re: AJAX Web Applications and Time Zones

Friday, July 07, 2006 11:19 AM by Marco
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

# re: AJAX Web Applications and Time Zones

Monday, September 04, 2006 3:11 PM by Server method undenfined!

web.config:

      <httpHandlers>

           <add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>

       </httpHandlers>

 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