A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: Date and Time Functions

style numbers, numbers for the style parameter of the ASE convert() function

The parameter style of the ASE® function convert() provides the possibility to format return values of dates and time using style numbers.

Default values for the style parameter are 0 or 100 with a four-digit output of the year (yyyy) and 9 or 109 with a four-digit output of the year plus milliseconds. When converting the datatype smalldatetime into char or varchar a style, with an output containing seconds or milliseconds, the time part is set to "0".

The style parameters of the ASE function convert() for formatting date and time output

year as (yy) year as(yyyy) Default Output
- 0 or 100 default mon dd yyyy hh:mm AM (or PM)
1 101 USA mm/dd/yy
2 2 SQL standard yy.mm.dd
3 103 English and French dd/mm/yy
4 104 German dd.mm.yy
5 105 dd-mm-yy
6 106 dd mon yy
7 107 mon dd, yy
8 108 HH:mm:ss
- 9 or 109 default + milliseconds mon dd yyyy hh:mm:sss AM (or PM)
10 110 USA mm-dd-yy
11 111 Japan yy/mm/dd
12 112 ISO yy/mm/dd
13 113 yy/mm/dd
14 114 yy/mm/dd
14 114 hh:mi:ss:mmmAM(or PM)
15 115 dd/yy/mm
16 116 mon dd yy HH:mm:ss
17 117 hh:mmAM
18 118 HH:mm
19 119 hh:mm:ss:zzzAM
20 120 hh:mm:ss:zzz
21 121 yy/mm/dd
22 122 yy/mm/dd
23 123 yyyy-mm-ddTHH:mm:ss

Legende:
mon = The first three letters of the month
mm = Number of the displayed month
HH = Hour in 24-hour-format
hh = Hour in 12-hour-format
S = Seperating character between date and time

See also:

ASE T-SQL - Aggregate Functions,
Date and Time Functions,
dateadd(),
datediff(),
datename(),
datepart(),
date_part,
day(),
getdate(),
month(),
year().