Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Date Function

Author  Topic 

amsqlguy
Yak Posting Veteran

89 Posts

Posted - 2008-09-22 : 13:13:47
Guys,

Is there any SQL function which gets only the date instead of timestamp

for example

select getdate()

Standard output
2008-09-22 13:12:37.880

Desired output
2008-09-22 00:00:00.000

Any suggestions/inputs would help

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-22 : 13:15:33
select dateadd(dd,datediff(dd,0,getdate()),0)
Go to Top of Page

amsqlguy
Yak Posting Veteran

89 Posts

Posted - 2008-09-22 : 13:25:55
quote:
Originally posted by visakh16

select dateadd(dd,datediff(dd,0,getdate()),0)



Thanks man - that works just perfect.
Go to Top of Page
   

- Advertisement -