set

英[set] 美[sɛt]

vt. Set; place, arrange; put in a certain situation; place tableware

vi. Setting off; setting off; condensation

n.Gathering; a set; a set; a TV set

adj. Fixed; located in...; stubborn; arranged The

third person singular: sets plural: sets present participle: setting past tense: set past participle: set

month

英[mʌnθ] Mei [mʌnθ]

n. Month, month; a month of time

Plural: months

javascript setMonth() method syntax

Function: is used to set the month.

Syntax: dateObject.setMonth(month,day)

##Parameters: month Required. A number representing the month, between 0 (January) and 11 (December). day is optional. A numeric value representing the day of the month, between 1 and 31 (in local time). Before EMCAScript was standardized, this parameter was not supported.


# Returns: The millisecond representation of the adjusted date. Before ECMAScript was standardized, this method returned nothing.

Note: This method is always used in conjunction with a Date object.

javascript setMonth() method example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script type="text/javascript">
//通过 setMonth() 方法把对象 d 的月字段设置为 0 (一月)
    var d=new Date()
    d.setMonth(0)
    document.write(d)

</script>

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance