views:

49

answers:

3

Hi,

I am getting a client date in javscript function using "new date()" object. But this object is considering the properties set for Date&Time control in the control panel of the system.

For example, If I check the check box of Date&Time control of the system (control panel) "Automatically adjust clock for daylight saving changes", then I am getting the date(from javscript) according to the Daylight savings time and if I uncheck it, I am getting the date according to the standard time.

What I need is to get the date from a Javscript function irrespective of the Date&Time control of the control panel.

Thanks Rupa.

A: 

Why can't you just generate the date from the server-side, where you have more control over this?

meder
Application(asp.net) is deployed in EST timezone and the this is used by the people in different time zones and the code is completely based on client time.Please suggest any way to solve the problem.
Rupa
Sounds like that application needs to be refactored.
meder
A: 

As you say, you are getting the time on the client, which is determined by the system clock of the client computer. If you want a constant time, you will have to get the time server side and expose it to your client-side script somehow.

Mark B
+1  A: 

Or base everything on UTC

Here is a timezone detection ignoring DST. Looks a bit brute force, but I could not find one I used to use http://www.michaelapproved.com/articles/timezone-detect-and-ignore-daylight-saving-time-dst/

mplungjan