setUTCDate method in javascript. In this tutorial, we will explain how to set utc date in javascript with example.
JavaScript setUTCDate() Method
Javascript setUTCDate() method, which is used to sets the day of the month for a specified date according to universal time.
Syntax
Date.setUTCDate(day_value)
Note :- day_value − it is an integer value from 1 to 31. This is representing the day of the month.
Example
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript date.setUTCDate Method</title> </head> <body> <script type = "text/javascript"> var date = new Date( "Nov 24, 2019 22:32:50" ); date.setUTCDate( 20 ); document.write( "The javascript date.setUTCDate() : " + date ); </script> </body> </html>
Result of the above code is
Conclusion
In this javascript set UTC date tutorial, you have learned how to set UTC date javascript with example.
You may like
- JavaScript: Date.getUTCDate() Method
- javaScript: getUTCFullYear Method
- getUTCMonth Method in JavaScript
- javaScript: getUTCDay() Method By E.g.
- Get UTC Hours, Minutes, Seconds, MilliSeconds javascript
- javaScript Digital Clock with date
- JavaScript: Set Date Methods
- String Contains JavaScript | String includes() Method
- JavaScript Get Date Methods
- JavaScript Operators With Examples
- Sorting Using JavaScript Array Sort() Method
- JavaScript Replace String With Examples
- JavaScript Array splice() Method By Example
- JavaScript: Clone an Array & Object By Example
If you have any questions or thoughts to share, use the comment form below to reach us.