new Date() in wrong time zone
Using moment.js is the easiest way to accomplish what you are asking.
moment().format() // "2017-01-11T13:56:15-05:00"
The output is a string in ISO-8601 format, with time zone offset in effect in your local time zone.
You could do this yourself with a lot of code that reads the various properties of the Date
object, building a string from those values. But it is not built-in to the Date
object in this way.
Also, note any time you try to adjust a Date
object by a time zone offset, you are simply picking a different point in time. You're not actually changing the behavior of the time zone being used by the Date object.
If you don't want to use any exteral JS file, You can simply use following code to get current timezone.
new Date().toString();