How to get Local Timezone in AngularJs?

To understand this particular question, it is very necessary to know that what exactly is AngularJs?

AngularJs is referred as a structural framework used for dynamic web app development. HTML is used as the template language and hence the extended form of HTML' s syntax, the application's components are expressed clearly. The data binding and dependency injection of AngularJs elimates the extra code, that can be shortened. Also it helps the browser by making it an ideal partner , which can be used in any server technology.

It is a completely client- side solution, as Angularjs have a totally different approach. The impedance mismatch is been minimized between the document centric HTML and an application. For example:

  • Data binding, as in {{}}.
  • Support for forms and form validation.
  • Attach the new behavior to DOM elements, which includes  DOM event handling.
  • Grouping of HTML into reusable components.

Now the main question that how can we get a local time zone in Angularjs?

It is a simple code that needs to be followed to convert the Universal time zone to Local time zone and that is:

(function () {
'use strict';
.filter('utcToLocal', utcToLocal);
function utcToLocal($filter) {
return function (utcDateString, format) {
if (!utcDateString) {
// append 'Z' to date string that indicates UTC time , as if the timezone is not already specified before
if (utcDateString.indexOf('Z') == -1 && utcDateString.indexOf('+') === -1) {
utcDateString += 'Z';
return $filter('date')(utcDateString, format);

Hence using the above code you will find your answer.

For high- quality web application development using Angular Is , contact Frantic infotech. We guarantee to be the best in the fiel of mobile and web application development.

Call us: 8447149178