公告
财富商城
积分规则
提问
发文
2020-02-10 02:56发布
Evening l夕情丶
How to get time part from SQL Server 2005 datetime in HH:mm tt format
HH:mm tt
E.g.
11:25 AM 14:36 PM
select cast(getdate() as time)) [time],
SQL Server 2008
SELECT CONVERT(TIME,GETDATE()) AS HourMinuteSecond, CONVERT(DATE,GETDATE(),101) AS DateOnly GO
Result
HourMinuteSecond: 13:06:56.5770000 DateOnly: 2012-07-26
SQL Server 2000/2005
SELECT CONVERT(VARCHAR(8),GETDATE(),108) AS HourMinuteSecond, CONVERT(VARCHAR(8),GETDATE(),101) AS DateOnly GO
http://blog.sqlauthority.com/2009/08/06/sql-server-get-time-in-hourminute-format-from-a-datetime-get-date-part-only-from-datetime/
Result:
最多设置5个标签!
SQL Server 2008
Result
SQL Server 2000/2005
http://blog.sqlauthority.com/2009/08/06/sql-server-get-time-in-hourminute-format-from-a-datetime-get-date-part-only-from-datetime/
SQL Server 2008
Result:
SQL Server 2000/2005