Combine date and hour fields

  • I have two fields in my data "date" and "hour".

    The "date" field has dates like "2015-04-09 00:00:00.000", that are all set to time "00:00:00.000".

    The "hour" field has the hours of the day 1 to 24, the all have the form "4".

    What I would like is a new FinalDate field that would combine the "date" and "hour" fields like "2015-04-09 04:00:00.000".

    I've attached sample data to illustrate what I'm trying to do. Any help greatly appreciated.

  • Hi,

    select DATEADD(hh,12,'2015-04-09 00:00:00.000')

    Replace 12 and '2015-04-09 00:00:00.000' with your table column name "Hour" and "Date"

    --chalam

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

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