Home > Article > Web Front-end > Set the hour of a specified date based on UTC?
JavaScript date setUTCHours() method sets the hour of the specified date based on local time. The following is the parameter list of setUTCHours(hoursValue[, minutesValue[, secondsValue[, msValue]]]):
You can try running the following code to set the hour of a specified date based on UTC:
<html> <head> <title>JavaScript setUTCHours Method</title> </head> <body> <script> var dt = new Date( "Aug 28, 2008 23:30:00" ); dt.setUTCHours( 15 ); document.write( dt ); </script> </body> </html>
The above is the detailed content of Set the hour of a specified date based on UTC?. For more information, please follow other related articles on the PHP Chinese website!