AJAX approach to localizing Date Time

I am pretty confident most of you people out there have developed web applications for global use which display date time according to the user’s local time zone. Although it is possible to do this on the server side, it is very efficient and easy to do this on the client side specially on the browser as JavaScript inherently provides Date() object which does UTC to Local conversion.

Imagine you have lot of labels and text boxes which require you to convert UTC date and time to local date and time. With the help of AJAX extenders you can do this on the client side very easily. So I have written an AJAX extender which runs on the client side to do the conversion automatically. When attached to a label or text box it will get the date and time in the control and convert it to the local date and time.

<asp:Label ID="DateLabel" runat="server" Text='<%#Eval("Date") %>' /> <cc2:UTCToLocalExtenderControl ID="UTCToLocalExtenderControl1" runat="server" TargetControlID="DateLabel" DateTimeFormatString="g" />

Majority of the work is being done in the extender behavior.js file.

Thanks
Anil