将日期转换为CYYMMDD SQL-Server [英] Convert Date to CYYMMDD SQL-Server
问题描述
我有兴趣使用本地SQL Server 2012函数将日期值转换为 CYYMMDD
。
这里:
http://www.sql-server-helper.com/tips/date-formats.aspx
,找不到任何东西。
任何人都知道吗?
http://msdn.microsoft.com/en-us/ library / hh213505.aspx
您应该可以使用这样的内容:
<$ p $或者其他什么你真的是一个真正的朋友吗?要使用 - 基本上, FORMAT
I am interested in converting a date value to CYYMMDD
using native SQL Server 2012 functions.
I checked here:
http://www.sql-server-helper.com/tips/date-formats.aspx
and couldn't find anything.
Anyone know?
C stands for century I guess...
Have you looked at the new FORMAT
function in SQL Server 2012?
http://msdn.microsoft.com/en-us/library/hh213505.aspx
You should be able to use something like this:
SELECT FORMAT(YourDateColumn, 'yyyyMMdd')
or whatever you really want to use - basically, the same formatting options as in C# / .NET are available when using FORMAT
这篇关于将日期转换为CYYMMDD SQL-Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!