日期:2014-05-18  浏览次数:20599 次

数字转换成英文日期
我想把01,02,03这类数字转换成jan,feb,mar这类
请问有什么简便的方法吗?

------解决方案--------------------
replace
------解决方案--------------------
SQL code
set language english
select convert(varchar(3),dateadd(m,number,'2011-01-01'),7) from master..spt_values where type='p' and number<12
/*
----
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec

(12 行受影响)

*/

------解决方案--------------------
SQL code
declare @language sysname
set @language=@@LANGUAGE
set language english
    select dateNAME(MONTH,dateadd(m,number,'2011-01-01'))
    from master..spt_values where type='p' and number<12
set language @language
/*
Changed language setting to us_english.

------------------------------
January
February
March
April
May
June
July
August
September
October
November
December

(12 行受影响)

已将语言设置更改为 简体中文。
*/

------解决方案--------------------
探讨

SQL code
set language english
select convert(varchar(3),dateadd(m,number,'2011-01-01'),7) from master..spt_values where type='p' and number<12
/*
----
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec……