|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
getdate() - 5 hrsHow can i return the getdate value minus 5 hrs
So if getdate is 2005/09/07 7am .. Id like to output to be 2005/09/07 2am Thanks SELECT DATEADD(hh, -5, GETDATE())
"Hassan" <hassan***@hotmail.com> wrote in message How can i return the getdate value minus 5 hrsnews:%23gQMybEtFHA.1252@TK2MSFTNGP09.phx.gbl... So if getdate is 2005/09/07 7am .. Id like to output to be 2005/09/07 2am Thanks SELECT DATEADD(hour, -5, CURRENT_TIMESTAMP)
-- Show quoteTibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://www.solidqualitylearning.com/ Blog: http://solidqualitylearning.com/blogs/tibor/ "Hassan" <hassan***@hotmail.com> wrote in message news:%23gQMybEtFHA.1252@TK2MSFTNGP09.phx.gbl... > How can i return the getdate value minus 5 hrs > > So if getdate is 2005/09/07 7am .. Id like to output to be 2005/09/07 2am > > Thanks > > Or
SELECT CONVERT(CHAR(10),GETDATE(),121)+ REVERSE(LEFT(STUFF(REVERSE( CONVERT(varchar,getdate(),9)),3,4,SPACE(0)),11)) Show quote "Hassan" <hassan***@hotmail.com> wrote in message news:%23gQMybEtFHA.1252@TK2MSFTNGP09.phx.gbl... > How can i return the getdate value minus 5 hrs > > So if getdate is 2005/09/07 7am .. Id like to output to be 2005/09/07 2am > > Thanks > |
|||||||||||||||||||||||