ASEconvert函数中的日期样式

关于ASEconvert函数中的日期样式,我把各个style值的情况枚举了一遍,供大家方便参考。


Date format conversions using the style parameter


Without century (yy)

With century (yyyy)

Standard

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/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:ss AM (or PM)

10

110

USA

mm-dd-yy

11

111

Japan

yy/mm/dd

12

112

ISO

yymmdd

13

113

 

yy/dd/mm

14

114

 

mm/yy/dd

14

114

 

hh:mi:ss:mmmAM(or PM)

15

115

 

dd/yy/mm

-

16 or 116

 

mon dd yyyy HH:mm:ss

17

117

 

hh:mmAM

18

118

 

HH:mm

19

  

hh:mm:ss:zzzAM

20

  

hh:mm:ss:zzz

21

  

yy/mm/dd HH:mm:ss

22

  

yy/mm/dd HH:mm AM (or PM)

23

  

yyyy-mm-ddTHH:mm:ss

The default values (style 0 or 100), and style 9 or 109 return the century (yyyy). When converting to char or varchar from smalldatetime, styles that include seconds or milliseconds show zeros in those positions.


假定当前日期为:2010-9-24,各个style值的日期显示格式。



select convert(varchar,getdate(),0)

Sep 24 2010 5:54AM

select convert(varchar,getdate(),1)

09/24/10

select convert(varchar,getdate(),2)

10.09.24

select convert(varchar,getdate(),3)

24/09/10

select convert(varchar,getdate(),4)

24.09.10

select convert(varchar,getdate(),5)

24-09-10

select convert(varchar,getdate(),6)

24 Sep 10

select convert(varchar,getdate(),7)

Sep 24, 10

select convert(varchar,getdate(),100)

Sep 24 2010 5:55AM

select convert(varchar,getdate(),101)

09/24/2010

select convert(varchar,getdate(),102)

2010.09.24

select convert(varchar,getdate(),103)

24/09/2010

select convert(varchar,getdate(),104)

24.09.2010

select convert(varchar,getdate(),105)

24-09-2010

select convert(varchar,getdate(),106)

24 Sep 2010

select convert(varchar,getdate(),107)

Sep 24, 2010



select convert(varchar,getdate(),8)

05:58:42

select convert(varchar,getdate(),9)

Sep 24 2010 5:58:48:640AM

select convert(varchar,getdate(),108)

05:59:09

select convert(varchar,getdate(),109)

Sep 24 2010 5:59:27:606AM



select convert(varchar,getdate(),10)

09-24-10

select convert(varchar,getdate(),11)

10/09/24

select convert(varchar,getdate(),12)

100924

select convert(varchar,getdate(),13)

10/24/09

select convert(varchar,getdate(),14)

09/10/24

select convert(varchar,getdate(),15)

24/10/09

select convert(varchar,getdate(),16)

Sep 24 2010 06:02:21

select convert(varchar,getdate(),17)

6:02AM

select convert(varchar,getdate(),18)

06:02

select convert(varchar,getdate(),19)

6:02:51:840AM

select convert(varchar,getdate(),20)

06:03:07:373

select convert(varchar,getdate(),21)

10/09/24 06:03:35

select convert(varchar,getdate(),22)

10/09/24 6:03AM

select convert(varchar,getdate(),23)

2010-09-24T06:03:50



select convert(varchar,getdate(),100)

Sep 24 2010 6:04AM

select convert(varchar,getdate(),101)

09/24/2010

select convert(varchar,getdate(),102)

2010.09.24

select convert(varchar,getdate(),103)

24/09/2010

select convert(varchar,getdate(),104)

24.09.2010

select convert(varchar,getdate(),15)

24-09-2010

select convert(varchar,getdate(),16)

24 Sep 2010

select convert(varchar,getdate(),107)

Sep 24, 2010

select convert(varchar,getdate(),108)

06:06:13

select convert(varchar,getdate(),109)

Sep 24 2010 6:06:20:826AM

select convert(varchar,getdate(),110)

09-24-2010

select convert(varchar,getdate(),111)

2010/09/24

select convert(varchar,getdate(),112)

20100924

select convert(varchar,getdate(),113)

2010/24/09

select convert(varchar,getdate(),114)

09/2010/24

select convert(varchar,getdate(),115)

24/2010/09

select convert(varchar,getdate(),116)

Sep 24 2010 06:08:10

select convert(varchar,getdate(),117)

2010/09/24 06:08:27

select convert(varchar,getdate(),118)

2010/09/24 6:08AM

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值