
NewYork.utc(true).toDate()//will give you the local time. For the sake of clarity, newYork.toDate()//will give you the Greenwich ,UK, time. utc(true) ,with the arg true, to your moment object. However if you just want your local time in this format (New York time, according to this example), just add the method. For more details, go through this article, about UTC. Now when you try to convert newYork (the moment object) with moment's toDate() (ISO 8601 format conversion) you will get the time of Greenwich,UK. For the sake of clarity, var newYork= moment.tz(" 12:00", "America/New_York") /*this code will consider NewYork as the timezone.*/ This function will return a moment object with a particular time zone. Now in order to use the timezone feature, use moment.tz("date_string/moment()","time_zone") (visit for more details). For the sake of clarity, const moment=require('moment-timezone')//import from moment-timezone
MOMENT FORMAT TODATA INSTALL
According to this answer here TypeError: moment().tz is not a function, you have to import moment from moment-timezone instead of the default moment (ofcourse you will have to npm install moment-timezone first!).
MOMENT FORMAT TODATA HOW TO
First you should understand how to use moment-timezone. Unless absolutely necessary, you should use a key such as America/Denver. They stem from POSIX style time zones, and only a few of them are in the TZDB data. Time Zones like MST7MDT are there for backwards compatibility reasons. You will find moment's parser to be much more reliable. If you are parsing from a string, pass that string directly into moment. Both will work but it's unnecessarily redundant. While the moment constructor can take a Date, it is usually best to not use one. There's nothing moment.js can do about that. A JavaScript Date object will always be printed in the local time zone of the computer it's running on.

Regarding the last to lines of your code - when you go back to a Date object using toDate(), you are giving up the behavior of moment.js and going back to JavaScript's behavior. Perhaps you are just trying to change the output format string? If so, just specify the parameters you want to the format method: momentObj.format("YYYY-MM-DD HH:mm:ss")

If you're going to do that, you don't need the original. Switching to UTC doesn't just drop the offset, it changes back to the UTC time zone. You are correctly converting the moment to the time zone, which is reflected in the second line of output from momentObj.format().

As long as you have initialized moment-timezone with the data for the zones you want, your code works as expected.
