Skip to content Skip to sidebar Skip to footer

Get User Time And Convert Them To Pst

I'm stuck on this problem to get a user time i would just do var getUserDateAndTime = new Date(); How would I convert that date time into the PST depending on where they are (EST

Solution 1:

You have to get the timezone offset from the client:

var offset = newDate().getTimezoneOffset();

Then you need the PST timezone offset and you can calculate it

ClientTime - ClientOffset + PSTOffset = current PST time

Post a Comment for "Get User Time And Convert Them To Pst"