Javascript setdate () method

Source: Internet
Author: User
Javascript setdate () method http://www.w3school.com.cn/js/jsref_setDate.asp

Javascript date object reference manual

Definition and usage

The setdate () method is used to set a day of a month.

Syntax
dateObject.setDate(day)
Parameters Description
Day Required. Represents a value (1 ~ 31 ).
Return Value

The millisecond representation of the adjusted date. Before ecmascript standardization, this method returns nothing.

Tips and notes:

Note: This method is always used in combination with a date object.

Instance

In this example, we will use the setdate () method to set the day of the current month to 15:

<script type="text/javascript">var d = new Date()d.setDate(15)document.write(d)</script>

Output:

Sun Jan 15 2012 21:04:52 GMT + 0800 (China Standard Time)
Tiy
Setdate ()
How to Use setdate () to set a day of the current month.

Javascript date object reference manual

Related Article

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.