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
 datetime without mins and secs

Author  Topic 

insanepaul
Posting Yak Master

178 Posts

Posted - 2011-11-10 : 09:46:53
How do I get the date time without the minutes and seconds so it looks like this:

dd/mm/yyyy hh:00:00

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-11-10 : 09:51:17
select DATEADD(hh,datediff(hh,0,getdate()),0)

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

insanepaul
Posting Yak Master

178 Posts

Posted - 2011-11-10 : 09:53:33
great thanks for that


quote:
Originally posted by nigelrivett

select DATEADD(hh,datediff(hh,0,getdate()),0)

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-11-10 : 09:54:41
Just curious as to what application (how your are going to use) that would apply to??

Care to share?

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

sql-programmers
Posting Yak Master

190 Posts

Posted - 2011-11-10 : 20:10:15
For further infromation on Time and Date formats take a look at...

http://www.sql-programmers.com/SQLResources/Queries/TimeandDateFormats.aspx

SQL Server Programmers and Consultants
http://www.sql-programmers.com/
Go to Top of Page
   

- Advertisement -