Skip to content

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

@yukanagai

Description

@yukanagai

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions