Get Current time in GMT/UTC using JavaScript

Make use of the toUTCString() method from the Date() constructor to get the current UTC time and date in JavaScript.


Example 1: Current Date and Time in UTC

    const date = new Date();
    const utcDateString = date.toUTCString();
    console.log("Current GMT Date Time: " + utcDateString);
    Output:

    Current GMT Date Time: Fri, 08 Sep 2023 12:23:04 GMT


Example 2: Current Time in GMT

    const date = new Date();
    const utcTimeString = date.toUTCString().split(" ")[4];
    console.log("Current GMT Time: " + utcTimeString);
    Output:

    Current GMT Time: 12:25:59


Example 3: Current Date in GMT

    const date = new Date();
    const utcDateString = date.toUTCString().split(" ").slice(1, 4).join(" ");
    console.log("Current GMT Date: " + utcDateString);
    Output:

    Current GMT Date: 08 Sep 2023


What is UTC Timezone?



UTC (Coordinated Universal Time) is a stable Global Time Standard, which does not observe Daylight Saving Time (DST) and is often used as a reference for precise timekeeping in JavaScript and various applications.


We can also make use of the toISOString() to get the time now in UTC/GMT.

Example 4: Date and Time in Zulu (Z/UTC/GMT)


JSFiddle Link: https://jsfiddle.net/r0b79zdh/

What is the difference between GMT/UTC/Zulu

GMT stands for - "Greenwich Mean Time" and is usually interchangeable with UTC - "Coordinated Universal Time", they both being stable Global Time Standards. "Zulu" is a military term referring to UTC, primarily in aviation.

Reference documentation and links:

GMT, UTC, Zulu Time:

Must Refer JavaScript Documentation:

JavaScript Current Date and Time in UTC GMT and Zulu Examples

This is not an AI-generated article but is demonstrated by a human on an M1 Mac running macOS Sonoma 14.0.

Please support independent contributors like Code2care by donating a coffee.

Buy me a coffee!

Buy Code2care a Coffee!

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!