MySqlDataReader.GetDateTime Method (Int32)

MySQL Connector/Net

MySqlDataReaderGetDateTime Method (Int32)
Gets the value of the specified column as a DateTime object.

Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll) Version: 6.9.9
Syntax
public override DateTime GetDateTime(
	int i
)
Public Overrides Function GetDateTime ( 
	i As Integer
) As DateTime
public:
virtual DateTime GetDateTime(
	int i
) override
abstract GetDateTime : 
        i : int -> DateTime 
override GetDateTime : 
        i : int -> DateTime 

Parameters

i
Type: SystemInt32
The zero-based column ordinal.

Return Value

Type: DateTime
The value of the specified column.

Implements

IDataRecordGetDateTime(Int32)
IDataRecordGetDateTime(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 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