DateAdd

  • How do I add a date to a time? For example, we have two columns in Appointment: ApptDate and ApptStart.
    The ApptStart is usually just a time and defaults to 1/1/1900 plus the time. I would like to add the value for ApptDate to the ApptStart time so instead of:
     
    ApptDate= 2007-8-06 00:00:00  and ApptStart=1900-01-01 10:15:00
    I want ApptStart to = 2007-08-06 10:15:00
     
    Thanks again.
  • declare @date1 datetime

    declare @date2  datetime

    set @Date1= '08/05/2007'

    set @Date2 = '01/01/1900 2:11:00 PM'

    select @Date1, @Date2

    --

    2007-08-05 00:00:00.000 1900-01-01 14:11:00.000

    select @Date1 + @Date2

    Result

    2007-08-05 14:11:00.000

  • it works. thanks

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

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