The setDate method changes the day of the month of a given Date instance, based on local time. To instead change the day of the month for a given Date instance based on UTC time, use the setUTCDate method. Void setDate (int parameterIndex, Date x) throws SQLException Sets the designated parameter to the given java.sql.Date value using the default time zone of the virtual machine that is running the application. The driver converts this to an SQL DATE value when it sends it to the database. Public final void setDate(int n, java.sql.Date x) Parameters. An int that indicates the parameter number. This setDate method is specified by the setDate method in the java.sql.PreparedStatement interface. SetDate Method (SQLServerPreparedStatement). SetDate void setDate(int parameterIndex, Date x) throws SQLException. Sets the designated parameter to the given java.sql.Date value using the default time zone of the virtual machine that is running the application. The driver converts this. The SetDate method assigns a DateTime value to the buffer column specified by the columnIndex parameter. This method works with the DTDBDATE data type in Integration Services.

Setdate method

The setDate() method changes the day of the month of a given Date instance, based on local time.

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

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.

Setdateheader

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
columnIndex
Int32

Setdate Java

The index of the column in the PipelineBuffer row.

value
DateTime

The value assigned to the buffer column.

Setdate

Remarks

The SetDate method assigns a DateTime value to the buffer column specified by the columnIndex parameter.

SetDate

Set Date&time

This method works with the DT_DBDATE data type in Integration Services.

Set Date

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.

Setdatetime

Applies to