In Version 9.7 Fix Pack 6 and later fix packs, the DB2DateTime structure is available for use only with Informix database server.
[Visual Basic]
Public Structure DB2DateTime
[C#]
public struct DB2DateTime
[C++]
public value class DB2DateTime
A DB2DateTime structure represents a single moment in the span of time from 00:00:00.00000 on 1 January 0001 to 23:59:59.99999 on 31 December 9999.
Time unit | Default value |
---|---|
Year | 1200 |
Month | 1 |
Day | 1 |
Hour | 0 |
Minute | 0 |
Second | 0 |
Fraction | 0 |
If the DB2DateTime structure is specified with a database server other than the Informix database server, a NotSupportedException message is thrown.
[C#] You can use the following code to retrieve a single DB2DateTime structure value from a table.
[C#]
public static string getParam(DB2Connection conn)
{
string mySelectQuery = "SELECT * FROM IN_TRAY";
DB2Command myCommand = new DB2Command(mySelectQuery, conn);
DB2DataReader reader = myCommand.ExecuteReader();
if (reader.Read())
{
DB2DateTime selectValue = reader.GetDB2DateTime(0);
if (!selectValue.IsNull) { return selectValue.ToString(); }
}
return "NULL";
}
Any public static (Shared in Visual Basic) members are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.