Home >Web Front-end >JS Tutorial >The JavaScript method getUTCDate() returns a day of the month (UTC) based on Universal Time
Definition and Usage
The getUTCDate() method returns the day of the month (UTC) based on Universal Time.
Syntax
dateObject.getUTCDate()
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>
Output:
6
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>
Output:
21
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>
This will produce the following results for India time zone:
getUTCDate() : 25
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!