Getting the Time Zone (just the timezone) using angular


I’m not sure if this is possible, but I want to get the PC’s Time Zone using Angular. I just need the timezone because I need to format it in (‘+H:MM’).

I understand Angular only formats it one way (‘+HHMM’), so I want to store this Time Zone and put in a string that I can then manipulate later.

Also I don’t want to use plugins and/or libraries, if possible.


I suggest you to use Momentjs:

Momentjs Formats

var from = new Date();
var date = moment(from).format('Z'); //ZZ



Or you can perform a regular expression on the Date:

var from = new Date();
var res = from.toString().match(/[\+,\-](\d{4})\s/g);


But I’m not sure it is very robust.

I hope it helps.

Answered By – thegio

Answer Checked By – Candace Johnson (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.