将日期转换为CYYMMDD SQL-Server [英] Convert Date to CYYMMDD SQL-Server

查看:235
本文介绍了将日期转换为CYYMMDD SQL-Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有兴趣使用本地SQL Server 2012函数将日期值转换为 CYYMMDD



这里:



http://www.sql-server-helper.com/tips/date-formats.aspx



,找不到任何东西。



任何人都知道吗?

代表世纪我猜...

FORMAT 函数?



http://msdn.microsoft.com/en-us/ library / hh213505.aspx



您应该可以使用这样的内容:

<$ p $或者其他什么你真的是一个真正的朋友吗?要使用 - 基本上, FORMAT

$ b时,可以使用与C#/ .NET中相同的格式化选项:110%29.aspxrel =nofollow $ b

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屋!

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