JavaScript getUTCDate function is one of the Date Functions, which returns the day of the month on a given date according to universal time.
JavaScript getUTCDate Example
In this example, we are using getUTCDate to return the day number of the month in the current date and time.
<!DOCTYPE html> <html> <head> <title> JS </title> </head> <body> <h1> Example </h1> <script> var dt = Date(); document.write("Date and Time : " + dt); document.write("UTC Date : " + dt.getUTCDate()); </script> </body> </html>
Example
Date and Time: Sun Nov 04 2018 16:30:02 GMT+0530 (Indian Standard Time)
UTC Date : 4
getUTCDate Function Example 2
In this JavaScript example, we are displaying the day number from the custom date.
<!DOCTYPE html> <html> <head> <title> JavaScriptGetUTCDateFunction </title> </head> <body> <h1> JavaScriptgetUTCDateFunctionExample </h1> <script> var dt = Date("December 14, 2016 11:22:34"); document.write("Date and Time : " + dt); document.write("UTC Date using getUTCDate(): " + dt.getUTCDate()); </script> </body> </html>