Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.1 » SQL Anywhere Server - SQL Reference » SQL data types » Date and time data types


Retrieval of dates and times from the database

Dates and times can be retrieved from the database in one of the following ways:

  • Using any interface, as a string

  • Using ODBC or OLE DB, as a binary value (using an ODBC TIMESTAMP_STRUCT structure for example)

  • Using embedded SQL, as a SQLDATETIME structure

Date and time of day with a time zone offset can be retrieved from the database as a string only.

When a date or time, with or without a time zone offset, is retrieved as a string, it is retrieved in the format specified by the database options date_format, time_format, timestamp_format, and timestamp_with_time_zone_format.

The following arithmetic operators are allowed on dates:

  • timestamp + integer   Add the specified number of days to a date or timestamp.

  • timestamp - integer   Subtract the specified number of days from a date or timestamp.

  • date - date   Compute the number of days between two dates or timestamps.

  • date + time   Create a timestamp combining the given date and time.

 Leap years
 See also