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
 General SQL Server Forums
 New to SQL Server Programming
 select only date without time

Author  Topic 

dhinasql
Posting Yak Master

195 Posts

Posted - 2009-04-24 : 00:57:38
I need to select the today date but without time
for ex: select getdate()

it has to show only '2009-04-23' not 2009-04-24 00:56:56.343

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-24 : 01:04:23
SELECT DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()), 0)



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-04-24 : 01:17:59
select convert(varchar,getdate(),101)

Regards

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-04-24 : 01:20:03
This is a presentation issue and therefore should be handled in the application. Just because you can do it with T-SQL doesn't mean you should.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

Kokkula
Starting Member

41 Posts

Posted - 2009-04-24 : 02:17:37
Hello,

Try this

SELECT REPLACE(CONVERT(NVARCHAR,GETDATE(),111),'/','-')

Hope helpful...


Thanks,
Pavan
Go to Top of Page

Kokkula
Starting Member

41 Posts

Posted - 2009-04-24 : 02:25:20
Hello,

Try this

SELECT REPLACE(CONVERT(NVARCHAR,GETDATE(),111),'/','-')

Hope helpful...


Thanks,
Pavan
Go to Top of Page

soorajtnpki
Posting Yak Master

231 Posts

Posted - 2009-04-24 : 05:04:08
try this also,

SELECT cast(DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()), 0) as varchar(11))

tanx...
Go to Top of Page
   

- Advertisement -