SQL Server中Date格式转换为DD/MMM/YYYY格式 [英] Convert Date format into DD/MMM/YYYY format in SQL Server

查看:24
本文介绍了SQL Server中Date格式转换为DD/MMM/YYYY格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在SQL中有一个查询,我必须以dd/mm/yy格式获取日期

I have a query in SQL, I have to get a date in a format of dd/mm/yy

示例:25/jun/2013.

我如何将它转换用于SQL server?

推荐答案

我不确定您想要的格式是否完全匹配.但是您可以通过 convert() 和样式 106.然后,替换空格:

I'm not sure there is an exact match for the format you want. But you can get close with convert() and style 106. Then, replace the spaces:

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

这篇关于SQL Server中Date格式转换为DD/MMM/YYYY格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆