خرید بک لینک

Vote count: 0

I know this seems like a straight forward question - but although Moment.js and moment timezone are very powerful tools for getting/setting and formatting dates..

I'm having an issue snapping my application to a single timezone.

What I want, is for a user to choose from a date/time picker - and to send that as a unix timestamp in UTC.. but the date/time picker MUST be considered to be BST.

In other words, even if you're using the site from abroad - the date/time you select should be the UTC value for if you had chosen it in the UK.

var local = moment(dateTime).unix();
var london = moment(dateTime).tz('Europe/London').unix();
var berlin = moment(dateTime).tz('Europe/Berlin').unix();

All 3 variables will equal the SAME UTC timestamp on the same machine, but a different timestamp on another machine ruing in a different timezone.

Think about it... if my date/time was 3pm on Saturday.. that's a DIFFERENT UTC in London than it is in Berlin, since it will occur one hour earlier in Berlin.

How do I force a date/time to be considered as a specific timezone?

Thanks :-)

asked 8 mins ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 1 ارديبهشت 1395 ساعت: 23:08

صفحه بندی