0

I updated this question

I would like to transform a datetime to the equivalent datetime in the country(timezone) user is located to.

I have datetime in this format which is UTC/GMT:

Oct 31, 2012 08:10:02

now, according with the user's client timezone i would like to convert that datetime using the current browser/client user's timezone

how can i do that?

10
  • 1
    The date time in javascript is GMT. And GMT == UTC. Commented Nov 3, 2012 at 15:19
  • it's not clear what you mean ... do you mean you want to use UTC as input instead of using date string? Commented Nov 3, 2012 at 15:22
  • @charlietfl i would like a completley UTC so GMT envoirment for javascript cause i have the same for php Commented Nov 3, 2012 at 15:24
  • I have no idea what that last statement means. Overall you have done very por job of explaing your issue Perhaps you want to look at Date.getTimezoneOffset() developer.mozilla.org/en-US/docs/JavaScript/Reference/… Commented Nov 3, 2012 at 15:27
  • 1
    can find a lot if you simply use google Commented Nov 3, 2012 at 17:17

1 Answer 1

1

If I understand correctly, you want to be able to set the end date for the countdown in UTC time, as opposed to the local time of the browser. You don't need to modify the plugin to do this. You just want the setUTC... methods in the Date object. Take a look here: http://www.w3schools.com/jsref/jsref_obj_date.asp.

For example:

var endofworld = new Date(0);
endofworld.setUTCFullYear(2012);
endofworld.setUTCMonth(11);
endofworld.setUTCDate(21);

$('.countdown').countdown({ date: endofworld });
Sign up to request clarification or add additional context in comments.

1 Comment

I've expanded upon my answer, and included an example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.