I want to get the Current Date object in UTC. I tried using new Date()
, Date.now()
etc. But they return the local time. How do I get the UTC date object?
I want the Date object, not string representation.
I want to get the Current Date object in UTC. I tried using new Date()
, Date.now()
etc. But they return the local time. How do I get the UTC date object?
I want the Date object, not string representation.
Just use new Date(new Date().toUTCString())
After converting to UTC, we have to again convert it into Date object if we need a Date Object.