Trent Trent - 1 year ago 149
AngularJS Question

Angular js : convert date to another timezone

I have to convert my date to different timezone based on the logged user timezone

I have tried

$scope.currentDate =;
$ = 'America/New_York';

In view i have called like this
{{currentDate | date:'h:mm a' : t}}

But it's not working., could i achieve this?

Answer Source

Make use of Moment timezone JS

var app = angular.module('app', []);

app.controller('mainCtrl', function($scope) {
  var now = moment(new Date());
  $scope.currentDate ='America/New_York').format('hh:mm a');
<script src=""></script>
<script src=""></script>

<script src=""></script>
<div ng-app='app'>
  <div ng-controller='mainCtrl'>
    <h4>{{ currentDate }}

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download