locked
change the time of a datetime value RRS feed

  • Question

  • I have 2 datetime values: StartDate ('11/01/2010 00:00:00') and  NewStartTime ('12/02/2010 09:30:00AM')
    I want to change the time value of StartDate to the time value of NewStartTime, the result should be '11/01/2010 09:30:00AM'
    not sure how to achieve this...
    thanks in advance!
    Achievement provides the ultimate pleasure in life
    Wednesday, February 3, 2010 7:38 AM

Answers

  • StartDate = StartDate.Date + NewStartTime.TimeOfDay;
    • Proposed as answer by Matthew Watson Wednesday, February 3, 2010 9:55 AM
    • Marked as answer by ssfftt Thursday, February 4, 2010 2:22 AM
    Wednesday, February 3, 2010 8:10 AM