0

Been searching for hours on how to do this. What i want to do is get the current local time by either offset -5, -6 etc or by America/Denver. I tried timezone-ls but maybe im just not doing it right it always comes back with local time. Any help would be appreciated. I know its something like get UTC time then deduct the offset but can't seem to figure it out. I have the offset data just need to know how to use it. Thanks in advance

This would be what i want
var utctime = utctimenow;
var dt = new timezoneJS.Date(utctime, 'America/Denver');

dt would be 8/22/2014 12:53 AM

user1054513
  • 605
  • 3
  • 13
  • 24
  • can you post what you have in the way of code please – haxxxton Aug 22 '14 at 06:41
  • 1
    I think your problem is discussed in http://stackoverflow.com/questions/85116/how-do-i-display-a-date-time-in-the-users-locale-format-and-time-offset – Övünç Metin Aug 22 '14 at 06:43
  • i have updated what im looking for been trying to use timezoneJS – user1054513 Aug 22 '14 at 06:55
  • Did you perform all of the setup required [as described in the documentation?](https://github.com/mde/timezone-js) – Matt Johnson-Pint Aug 22 '14 at 06:59
  • 1
    You may also want to consider one of the other libraries that can do this. I list [several of them here](http://stackoverflow.com/a/15171030/634824). Moment-timezone is much easier to use, as it requires no server-side setup. – Matt Johnson-Pint Aug 22 '14 at 07:01
  • is there a good tutorial to install moment i downloaded it and included moment-timezone-with-data.js but it says moment is not defined – user1054513 Aug 22 '14 at 07:08
  • ok i also needed moment.js then i just used this to get the current time console.log(moment().tz("America/Denver").format()); Thanks all for your help – user1054513 Aug 22 '14 at 07:16

0 Answers0