EasyManua.ls Logo

Sybase Adaptive Server Anywhere - Date and Time Data Types

Sybase Adaptive Server Anywhere
1182 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 7 SQL Data Types
277
Date and time data types
For storing dates and times.
Sending dates and times to the database
Dates and times may be sent to the database in one of the following ways:
Using any interface, as a string
Using ODBC, as a TIMESTAMP structure
Using Embedded SQL, as a SQLDATETIME structure
When a time is sent to the database as a string (for the TIME data type) or as
part of a string (for TIMESTAMP or DATE data types), the hours, minutes,
and seconds must be separated by colons in the format hh:mm:ss.sss, but can
appear anywhere in the string. The following are valid and unambiguous
strings for specifying times:
21:35 -- 24 hour clock if no am or pm specified
10:00pm -- pm specified, so interpreted as 12 hour clock
10:00 -- 10:00am in the absence of pm
10:23:32.234 -- seconds and fractions of a second
included
When a date is sent to the database as a string, conversion to a date is
automatic. The string can be supplied in one of two ways:
As a string of format yyyy/mm/dd or yyyy-mm-dd, which is interpreted
unambiguously by the database
As a string interpreted according to the DATE_ORDER database option
Transact-SQL compatibility of string-to-date/time conversions
There are some differences in behavior between Adaptive Server Anywhere
and Adaptive Server Enterprise, when converting strings to date and time
data types.
If a string containing only a time value (no date) is converted to a date/time
data type, Adaptive Server Enterprise uses a default date of January 1, 1900,
but Adaptive Server Anywhere uses the current date.
Function

Table of Contents

Related product manuals