Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help getting date in format YYYY-MM-DD 00:00:00.000

Status
Not open for further replies.

bmacbmac

IS-IT--Management
Jan 26, 2006
392
US
Hi,

I am trying to get the current date in format YYYY-MM-DD 00:00:00.000. I have tried a bunch of options like:

Code:
select convert(char(25), convert(datetime, getdate(), 101), 121)

and

Code:
select convert(datetime, getdate(), 105)

But they all give the date/time as: 2013-09-25 16:38:42.770. I am hoping to get 2013-09-25 00:00:00.000 instead. Any idea on the way to do this?

Thanks!
 
Code:
select DATEADD(dd, 0,DATEDIFF(dd, 0, GETDATE()))

Borislav Borissov
VFP9 SP2, SQL Server
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top