hh:mm的日期格式:sql中AM / PM中的ss [英] Date format for hh:mm:ss in AM/PM in sql

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

问题描述

我想要日期的日期格式..格式应该像hh:mm:ss AM / PM

请帮我找到它。

I want the date format for a date..The format should be like hh:mm:ss AM/PM
Please help me to find it.

推荐答案

检查这个



Check this

DECLARE @MyDate datetime
SET @MyDate = Getdate()
SELECT
CASE WHEN DATEPART(HOUR,@MyDate) >12 then Convert(VARCHAR(28), Cast(@MyDate AS DATETIME), 8) +' PM'
ELSE
Convert(VARCHAR(28), Cast(@MyDate AS DATETIME), 8) +' AM'
END


我认为sqlserver中最好的日期格式是DateTime,它同时包含日期和时间
I think the best date format in sqlserver is DateTime which has both date and time altogether


使用以下链接....

[日期时间格式]



问候,

Vijay
Go with below link ....
[Date time Format ]

Regards,
Vijay


这篇关于hh:mm的日期格式:sql中AM / PM中的ss的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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