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

SQL Anywhere 10.0.1 » SQL Anywhere Server - Database Administration » Database Options » Introduction to database options » Alphabetical list of options

database_authentication [database] Next Page

date_format option [compatibility]


Sets the format for dates retrieved from the database.

For more information about controlling the interpretation of date formats, see date_order option [compatibility].

Allowed values

String

Default

'YYYY-MM-DD' (this corresponds to ISO date format specifications)

Scope

Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.

Remarks

The format is a string using the following symbols:

Symbol Description
yy Two digit year
yyyy Four digit year
mm Two digit month
mmm[m...] Character short form for months
d Single digit day of week, (0 = Sunday, 6 = Saturday)

dd

Two digit day of month
ddd[d...] Character short form for days of the week
jjj Day of the year, from 1 to 366

Each symbol is substituted with the appropriate data for the date that is being formatted.

If the character data is multibyte, the length of each symbol reflects the number of characters, not the number of bytes. For example, the 'mmm' symbol specifies a length of three characters for the month.

For symbols that represent character data (such as mmm), you can control the case of the output as follows:

For symbols that represent numeric data, you can control zero-padding with the case of the symbols:

See also
Example

The following table illustrates date_format settings, together with the output from the following statement, executed on Friday June 2, 2006.

SELECT CURRENT DATE
date_format SELECT CURRENT DATE
yyyy/mm/dd/ddd 2006/06/02/fri
yyyy/Mm/Dd/ddd2006/6/2/fri
jjj 153
mmm yyyy jun 2006
Mmm yyyyJun 2006
mm-yyyy 06-2006