The setDate()
method changes the day of the month of a given Date
instance, based on local time.
Javascript date setDate method sets the day of the month for a specified date according to local time. Its syntax is as follows −. Date.setDate( dayValue ) Parameter Detail. DayValue − An integer from 1 to 31, representing the day of the month. Try the following example. The setDate method sets the day of the Date object relative to the beginning of the currently set month.
Set Date
To instead change the day of the month for a given Date
instance based on UTC time, use the setUTCDate()
method.
Syntax
Parameters
dayValue
- An integer representing the day of the month.
Return value
The number of milliseconds between 1 January 1970 00:00:00 UTC and the given date (the Date
object is also changed in place).
Description
Setdate Java
If the dayValue
is outside of the range of date values for the month, setDate()
will update the Date
object accordingly.
For example, if 0 is provided for dayValue
, the date will be set to the last day of the previous month.
If a negative number is provided for dayValue
, the date will be set counting backwards from the last day of the previous month. -1 would result in the date being set to 1 day before the last day of the previous month.
Examples
Using setDate()
Specifications
Specification |
---|
ECMAScript (ECMA-262) The definition of 'Date.prototype.setDate' in that specification. |
Browser compatibility
BCD tables only load in the browser
See also
-->Definition
Assigns a DateTime value to the PipelineBuffer column.
Parameters
Setdate Mmdd Hhmm Mmddhhmm Cc Yy.ss
- columnIndex
- Int32
The index of the column in the PipelineBuffer row.
- value
- DateTime
The value assigned to the buffer column.
Remarks
The SetDate method assigns a DateTime
value to the buffer column specified by the columnIndex
parameter.
This method works with the DT_DBDATE data type in Integration Services.
If the DataType of the buffer column is not DT_DBDATE, an UnsupportedBufferDataTypeException occurs.
For a complete list of Integration Services data types and the corresponding Get
and Set
methods of the PipelineBuffer class to use with each type, see Working with Data Types in the Data Flow.