SQL中的日期时间格式 [英] date time format in sql

查看:112
本文介绍了SQL中的日期时间格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的日期采用特定格式,例如dd mon yyyy,例如2011年1月1日.请告诉我代码

i want my date in particular format dd mon yyyy eg 1 jan 2011.plz tell me the code

推荐答案

SQL日期始终采用yyyy-MM格式-dd(ISO 8601)

您为什么要更改它?您应该只在程序的用户界面部分而不是在数据库访问中格式化日期.
SQL dates are always in the format yyyy-MM-dd (ISO 8601)

Why would you want to change it? You should only format dates in the user interface part of your program, not in the db access.


尝试一下,
Try this,
Select CONVERT(VARCHAR(11), GETDATE(), 106) AS [DD MON YYYY]


在这里,我给出了GETDATE().您可以输入日期字段名称.

更多此处 [


Here, i given GETDATE(). You can give your date field name.

More here[^].


这篇关于SQL中的日期时间格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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