开发者

SQL Server date_format

开发者 https://www.devze.com 2023-01-21 16:05 出处:网络
What is the function DATE_FORMAT in SQL Server I want to change my now date to d-m-Y h:i 开发者_如何学JAVAHow to doI\'m afraid that, in SQL Server, giving format to a date is not as simple as it sh

What is the function DATE_FORMAT in SQL Server

I want to change my now date to d-m-Y h:i

开发者_如何学JAVAHow to do


I'm afraid that, in SQL Server, giving format to a date is not as simple as it should. You end up doing stuff like:

CONVERT(VARCHAR, CURRENT_TIMESTAMP, 103) + ' ' + CONVERT(VARCHAR(8), CURRENT_TIMESTAMP, 114)

You can find the reference at http://msdn.microsoft.com/es-es/library/ms187928.aspx


The MySQL documentation for date_format is pretty good.

select date_format(NOW(), '%d-%m-%Y %H:%i');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号