Home Web Front-end JS Tutorial The JavaScript method getUTCDate() returns a day of the month (UTC) based on Universal Time

The JavaScript method getUTCDate() returns a day of the month (UTC) based on Universal Time

Nov 06, 2017 pm 01:13 PM
javascript js

Definition and Usage

The getUTCDate() method returns the day of the month (UTC) based on Universal Time.

Syntax

dateObject.getUTCDate()
Copy after login

Return value

dateObject When expressed in universal time, returns the day of the month (a value from 1 to 31).

Tips and Comments:

Comments: This method is always used in conjunction with a Date object.

Tip: For more information about Universal Coordinated Time (UTC), please refer to Baidu Encyclopedia.

Example

Example 1

In this example, we will output the current day of this appointment according to UTC:

<script type="text/javascript">

var d = new Date()
document.write(d.getUTCDate())

</script>
Copy after login

Output:

6
Copy after login

Example 2

We define a variable with a specific date here, and then output the day of the month in the variable according to UTC:

<script type="text/javascript">

var birthday = new Date("July 21, 1983 01:15:00")
document.write(birthday.getUTCDate())

</script>
Copy after login

Output:

21
Copy after login

JavaScript Date.getUTCDate() method returns the day of the month on the specified date according to universal time. The value returned by getUTCDate is an integer between 1 and 31.

Example:

<html>
<head>
<title>JavaScript getUTCDate Method</title>
</head>
<body>
<script type="text/javascript">
  var dt = new Date( "December 25, 1995 23:15:20" );
  document.write("getUTCDate() : " + dt.getUTCDate() ); 
</script>
</body>
</html>
Copy after login

This will produce the following results for India time zone:

getUTCDate() : 25
Copy after login

The above is the detailed content of The JavaScript method getUTCDate() returns a day of the month (UTC) based on Universal Time. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to implement an online speech recognition system using WebSocket and JavaScript How to implement an online speech recognition system using WebSocket and JavaScript Dec 17, 2023 pm 02:54 PM

How to implement an online speech recognition system using WebSocket and JavaScript

Recommended: Excellent JS open source face detection and recognition project Recommended: Excellent JS open source face detection and recognition project Apr 03, 2024 am 11:55 AM

Recommended: Excellent JS open source face detection and recognition project

Essential tools for stock analysis: Learn the steps to draw candle charts with PHP and JS Essential tools for stock analysis: Learn the steps to draw candle charts with PHP and JS Dec 17, 2023 pm 06:55 PM

Essential tools for stock analysis: Learn the steps to draw candle charts with PHP and JS

WebSocket and JavaScript: key technologies for implementing real-time monitoring systems WebSocket and JavaScript: key technologies for implementing real-time monitoring systems Dec 17, 2023 pm 05:30 PM

WebSocket and JavaScript: key technologies for implementing real-time monitoring systems

PHP and JS Development Tips: Master the Method of Drawing Stock Candle Charts PHP and JS Development Tips: Master the Method of Drawing Stock Candle Charts Dec 18, 2023 pm 03:39 PM

PHP and JS Development Tips: Master the Method of Drawing Stock Candle Charts

How to implement an online reservation system using WebSocket and JavaScript How to implement an online reservation system using WebSocket and JavaScript Dec 17, 2023 am 09:39 AM

How to implement an online reservation system using WebSocket and JavaScript

How to use JavaScript and WebSocket to implement a real-time online ordering system How to use JavaScript and WebSocket to implement a real-time online ordering system Dec 17, 2023 pm 12:09 PM

How to use JavaScript and WebSocket to implement a real-time online ordering system

Simple JavaScript Tutorial: How to Get HTTP Status Code Simple JavaScript Tutorial: How to Get HTTP Status Code Jan 05, 2024 pm 06:08 PM

Simple JavaScript Tutorial: How to Get HTTP Status Code

See all articles