How to capture only the hour from the particular datetime in sql

  • Hi ,

    I want to get the only the "hour" for the particular datetime ,

    For example :

    If we write ---select year(getdate()) --it gives you the result say -2009 as year ,

    in the same way i want to get the "hour "

    what is the Function used to get the hour from the getdate() .

    thanks in advanced

    jaya

  • lookup "datepart" in BOL



    Clear Sky SQL
    My Blog[/url]

  • Try this:

    SELECT DATEPART(hh,GETDATE())

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply