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

SQL Anywhere 11.0.0 » SQL Anywhere Server - Database Administration » Configuring Your Database » Database options » Introduction to database options » Alphabetical list of options


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



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


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


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, (1 = Sunday, 7 = Saturday)


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:

  • Type the symbol in all uppercase to have the format appear in all uppercase. For example, MMM produces JAN.
  • Type the symbol in all lowercase to have the format appear in all lowercase. For example, mmm produces jan.
  • Type the symbol in mixed case to have SQL Anywhere choose the appropriate case for the language that is being used. For example, in English, typing Mmm produces May, while in French it produces mai.

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

  • Type the symbol in same-case (such as MM or mm) to allow zero padding. For example, yyyy/mm/dd could produce 2002/01/01.
  • Type the symbol in mixed case (such as Mm) to suppress zero padding. For example, yyyy/Mm/Dd could produce 2002/1/1.
See also

The following table illustrates date_format settings, together with the output from the following statement, executed on Monday, April 14, 2008.

date_format CURRENT DATE
yyyy/mm/dd/ddd 2008/04/14/mon
yyyy/Mm/Dd/ddd 2008/4/14/mon
jjj 105
mmm yyyy apr 2008
Mmm yyyy Apr 2008
mm-yyyy 04-2008