Introduction to the use of the setHours () method in JavaScript, javascriptsethours

Source: Internet
Author: User

Introduction to the use of the setHours () method in JavaScript, javascriptsethours

The javascript Date. setHours () method sets the hour on the specified Date according to the local time.
Syntax

Date.setHours(hoursValue[, minutesValue[,                  secondsValue[, msValue]]])

Note: parameters in brackets are optional.

The following is the detailed information about the parameters:

  • HoursValue: an integer between 0 and 23, representing the hour
  • MinutesValue: an integer between 0 and 59, representing minutes
  • SecondsValue: an integer between 0 and 59, representing the second. If you specify the secondsValue parameter, you must also specify minutesValue
  • MsValue: a number between 0 and 999, representing milliseconds. If the msValue parameter is specified, minutesValue and secondsValue must also be specified.

If the minutesValue, secondsValue, and msValue parameters are not specified, use the getUTCMinutes, getUTCSeconds, and getMilliseconds methods to return values.
Return Value:

  • NA

Example:

This produces the following results:

Thu Aug 28 02:30:00 UTC+0530 2008 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.