I have a problem, and maybe someone can help me, I'll explain ...
- I have javascript "var date = new date ();" And it gives me local time (browser time), but I want this data / time force for a specific local ... for example ... Spain wants me every time someone in the page ( From the second country), the Spanish Hours are required on the date.
I got some solution but the problem is heat time and winter time ... we have offset variations because some time is +1 hour and others are +2 .... < / P>
Can anyone help me?
Thanks jrms_pnf@hotmail.com
Take a look at this article: < / p>
he was taken directly to:
function Kailsetaim (town, offset) {// current date object Create space d = new Date (to); // Convert to MSEC / Add local time zone offset // get UTC time in MSE UTC = d.getTime () + (d.getTimezoneOffset () * 60000); // Create new date object for different city // supply offset ND = new date (UTC + (3600000 * offset)); // Return Time String Returns is "local time" in "city +" + nd.toLocaleString (); }
Call it like this: alert (calteitum ('Bombay', '5.5')); // Get Bombay Time
You may have to add some logic to keep Daylight Savings Time in mind.
Comments
Post a Comment