Reputation: 13342
ctrl.time1 = $filter('date')(new Date(),"MMM dd yyyy - HH:mm:ss");
ctrl.time2 = $filter('date')(new Date(),"MMM dd yyyy - HH:mm:ss", "-06:00");
On the page:
<div>ctrl.time1: {{::dateTimeCtrl.time1}}</div>
<div>ctrl.time2: {{::dateTimeCtrl.time2}}</div>
time1 = time2 = Feb 05 2015 - 09:16:25
I wonder why?
Upvotes: 0
Views: 4703
Reputation: 8169
Not sure, but maybe this?
From AngularJS date filter documentation:
$filter('date')(date, format, timezone)
...
timezone
(optional): Timezone to be used for formatting. Right now, only 'UTC' is supported. If not specified, the timezone of the browser will be used.
What about trying the following:
$scope.time1 = $filter('date')(new Date(),"MMM dd yyyy - HH:mm:ss");
$scope.time2 = $filter('date')(new Date(),"MMM dd yyyy - HH:mm:ss -0600");
Upvotes: 2