JavaScript .getUTCDate()

Anonymous contributor's avatar
Anonymous contributor
Published Jun 12, 2023Updated Jul 18, 2024

The .getUTCDate() returns the day of the month for the provided date according to universal time.

  • Front-end engineers work closely with designers to make websites beautiful, functional, and fast.
    • Includes 34 Courses
    • With Professional Certification
    • Beginner Friendly.
      115 hours
  • Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
    • Beginner Friendly.
      15 hours

Syntax

myDate.getUTCDate()

The .getUTCDate() method returns the day of the month as an integer (1-31) for the provided date myDate.

Example

In the example below, the variable myDate stores the day of the month returned from a new Date object and logs the value to the console.

const myDate = new Date('2023-03-01');
console.log(myDate.getUTCDate());

This results in the following output:

1

Codebyte Example

The following code demonstrates how the .getUTCDate() method works:

Code
Output

All contributors

Learn JavaScript on Codecademy

  • Front-end engineers work closely with designers to make websites beautiful, functional, and fast.
    • Includes 34 Courses
    • With Professional Certification
    • Beginner Friendly.
      115 hours
  • Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
    • Beginner Friendly.
      15 hours