GetDateTime Method (String)

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 DateTime GetDateTime(
	string column
)
Visual Basic (Declaration)
Public Function GetDateTime ( _
	column As String _
) As DateTime
Visual C++
public:
DateTime GetDateTime(
	String^ column
)

Parameters

column
Type: System..::.String
The column name.

Return Value

The value of the specified column.

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