Jump to content

Recommended Posts

I have the same issue my friend.

 

I'm having problems with DST and offsetting the time, I posted on Friday and after 40 something views I'm still no better off.

 

I'll be watching this topic with interest.

 

Best of luck mate, I hope someone can help us out.

Got this from http://stackoverflow.com/questions/948532/how-do-you-convert-a-javascript-date-to-utc

var now = new Date(); 
var now_utc = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(),  now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());

i solved my problem and all is working fine now.

 

i hope that this will help some people.

 

also first i had it like this:

 

// months must be -1 !!! because it counts from 0 to 11 and not from 1 to 12

var utcdate = new Date.UTC(2011,2,15);

 

and it didn't work because of the "new" before Date.UTC which i didn't knew that it shouldn't be there, because it has to be if you use only Date and not Date.UTC

 

and now it's working perfect like this:

 

var utcdate = Date.UTC(2011,2,15);

 

and you get the time / date in miliseconds i think... you have to divide the time you get with 1000 to get seconds. and then with 60 to get minutes and then with 60 once more to get hours and then with 24 to get days, etc. ...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.