Similar question here
I will rewrite my answer and suggest a union:
The release of UTC seems to be the subject of some confusion - people seem to gravitate to the moment .
Borrowing from this answer , you can do something like this (i.e. use the convert function, which creates the date using the UTC constructor) without moment.js:
controller
var app1 = angular.module('app1',[]); app1.controller('ctrl',['$scope',function($scope){ var toUTCDate = function(date){ var _utc = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds()); return _utc; }; var millisToUTCDate = function(millis){ return toUTCDate(new Date(millis)); }; $scope.toUTCDate = toUTCDate; $scope.millisToUTCDate = millisToUTCDate; }]);
template
<html ng-app="app1"> <head> <script data-require="angular.js@*" data-semver="1.2.12" src="http://code.angularjs.org/1.2.12/angular.js"></script> <link rel="stylesheet" href="style.css" /> <script src="script.js"></script> </head> <body> <div ng-controller="ctrl"> <div> utc {{millisToUTCDate(1400167800) | date:'dd-M-yyyy H:mm'}} </div> <div> local {{1400167800 | date:'dd-M-yyyy H:mm'}} </div> </div> </body> </html>
here is the plunker to play with him
See also this and this .
Also note that when using this method, if you use the 'Z' angle date filter, it looks like it will still print your local time zone offset.
ossek Feb 14 '14 at 17:19 2014-02-14 17:19
source share