Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set a new Date() value with dynamic timezone #19

Open
yukanagai opened this issue Jan 31, 2020 · 0 comments
Open

How to set a new Date() value with dynamic timezone #19

yukanagai opened this issue Jan 31, 2020 · 0 comments

Comments

@yukanagai
Copy link

yukanagai commented Jan 31, 2020

How can I create a new Date() value set to a specific timezone -- and get the timezone offset programatically? Right now I'm hard coding the timezone but these change throughout the year with daylight savings etc.

var dateInTimezone = new Date("2020-03-03 10:00:00 UTC+8:00");

Is there a way to set new Date( date + getTimezoneVal )?

Example scenario:
Submitting a date (ie. 2020-03-03 @ 10am) via a form -- but set the timestamp to 2020-03-03 10am HKT while you're in NYC.

@yukanagai yukanagai changed the title How to set a new Date() value with timezone How to set a new Date() value with dynamic timezone Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant