GetDateTime Method (Int32)

MySQL Connector/Net

Gets the value of the specified column as a DateTime object.

Namespace:  MySql.Data.MySqlClient
Assembly:  MySql.Data (in MySql.Data.dll) Version: 6.2.2.0

Syntax

C#
public override DateTime GetDateTime(
	int i
)
Visual Basic (Declaration)
Public Overrides Function GetDateTime ( _
	i As Integer _
) As DateTime
Visual C++
public:
virtual DateTime GetDateTime(
	int i
) override

Parameters

i
Type: System..::.Int32
The zero-based column ordinal.

Return Value

The value of the specified column.

Implements

IDataRecord..::.GetDateTime(Int32)
IDataRecord..::.GetDateTime(Int32)

Remarks

No conversions are performed; therefore, the data retrieved must already be a DateTime object.

Call IsDBNull to check for null values before calling this method.

Note:

MySql allows date columns to contain the value '0000-00-00' and datetime columns to contain the value '0000-00-00 00:00:00'. The DateTime structure cannot contain or represent these values. To read a datetime value from a column that might contain zero values, use GetMySqlDateTime(Int32).

The behavior of reading a zero datetime column using this method is defined by the ZeroDateTimeBehavior connection string option. For more information on this option, please refer to ConnectionString.

See Also