本文介绍了Sql 2008:将日期时间转换为小时和分钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有日期时间的列,我想将其转换为小时和分钟/分钟,任何可以帮助我的sql语句?



(NB仍然是学习者)

I have a column which has date-time,i want to convert that into hours and minutes/minutes only,any sql statement that can help me?

(NB still a learner)

推荐答案

SELECT GETDATE()
GO
-- SQL Server 2000/2005
SELECT CONVERT(VARCHAR(8),GETDATE(),108) AS HourMinuteSecond,
CONVERT(VARCHAR(10),GETDATE(),101) AS DateOnly;
GO
-- SQL Server 2008 Onwards
SELECT CONVERT(TIME,GETDATE()) AS HourMinuteSeconds;
SELECT CONVERT(DATE,GETDATE()) AS DateOnly;
GO



查看链接

[]



Regrds,

GVPrabu


Check the link
Get Date and Time From Current DateTime [^]

Regrds,
GVPrabu



SELECT CONVERT(VARCHAR(8),GETDATE(),114) AS Hoursminuteseconds


这篇关于Sql 2008:将日期时间转换为小时和分钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 04:34