Get the GMT date using JavaScript

 

UTC to GMT

 

Use the toUTCString() method to get the GMT representation of a date, eg new Date().toUTCString(). The method converts the date to a string using the UTC time zone, which shares the same current time with GMT.

//Get timestamp in locale 
var tDate = new Date();

//Convert timestamp in GMT/UTC format 
var utcDate = tDate.toUTCString(); 

console.log(utcDate);

 

The difference between them is that GMT is a time zone, whereas UTC is a time standard and is the basis for time zones worldwide.


Tags:

Share:

Related posts