How can I initialize a JavaScript Date object to a specific time zone?

I’ve worked a lot with date formatting in international apps, and honestly, if you’re looking to format a JavaScript Date object to a specific time zone, Intl.DateTimeFormat is a great starting point. It doesn’t modify the original Date object, but it lets you view it as if it were in another time zone.

var dateStr = "Feb 28, 2013, 7:00 PM";
var options = { timeZone: 'America/New_York', hour12: true };
var formatter = new Intl.DateTimeFormat('en-US', options);
var date = new Date(dateStr);
console.log(formatter.format(date));  // Displays date in America/New_York time

The best part? It handles daylight saving time for you. So while it doesn’t change the core Date object’s time zone, it lets you view it as if it were in that zone. If you need more control over the Date itself though… read on.