Reputation: 655
I am using var
date= new Date();
in my controller to get current local time. I am getting the output like this-
var date=Mon Aug 03 2015 07:56:55 GMT +0530(India Standard Time)
but i need UTC time. How to get UTC time in angularjs or convert local time into UTC time.
Upvotes: 2
Views: 7401
Reputation: 3934
using moment.js
you can convert the local date to UTC
date easily.
Syntax
moment.utc(Date);
Upvotes: 0
Reputation: 655
var date=new Date(); //will give local time
var date1=date..toUTCString(); //will give
Upvotes: 1