May 27, 2003 at 8:10 am
I would like to return an datetime field as Date and the Hour segment with the Minute segment always set to '00' ?
May 27, 2003 at 8:44 am
select cast((convert(varchar(4), DATEPART( yy , getdate())) + '-' +
convert(varchar(2), DATEPART(mm , getdate())) + '-' +
convert(varchar(2), DATEPART(dd , getdate())) + ' ' +
convert(varchar(2), DATEPART(hh , getdate())) + ':' + '00:00') as datetime)
May 27, 2003 at 8:54 am
Here is another alternative:
select cast((convert(char(13),getdate(),120) + ':00:00.000') as datetime)
Gregory Larsen, DBA
If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples
Gregory A. Larsen, MVP
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply