Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
489 views
in Technique[技术] by (71.8m points)

sql - 在SQL Server中将日期格式转换为DD / MMM / YYYY格式(Convert Date format into DD/MMM/YYYY format in SQL Server)

I have a query in sql, I have to get date in a format of dd/mmm/yy

(我在sql中有一个查询,我必须以dd/mmm/yy的格式获取日期)

Example: 25/jun/2013 .

(示例: 25/jun/2013 。)

How can I convert it for SQL server?

(如何将其转换为SQL Server?)

  ask by Krish KvR translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I'm not sure there is an exact match for the format you want.

(我不确定您想要的格式是否完全匹配。)

But you can get close with convert() and style 106 .

(但是你可以用convert()和style 106来接近。)

Then, replace the spaces:

(然后,替换空格:)

SELECT replace(convert(NVARCHAR, getdate(), 106), ' ', '/')

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...