Home All Groups Group Topic Archive Search About
Author
8 Sep 2005 7:28 AM
Hassan
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

Author
8 Sep 2005 7:36 AM
Narayana Vyas Kondreddi
SELECT DATEADD(hh, -5, GETDATE())
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @ http://vyaskn.tripod.com/


"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
Author
8 Sep 2005 7:37 AM
Tibor Karaszi
SELECT DATEADD(hour, -5, CURRENT_TIMESTAMP)

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
>
>
Author
8 Sep 2005 7:55 AM
Uri Dimant
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
>

AddThis Social Bookmark Button