John,
In addition to the other comments.
Hint: Outlook actually stores a single field, but displays it with two
controls!
I would have a startDateTime, add the TimeSpan, to get the new
startDateTime.
Dim startDateTime As DateTime = #7/1/2004 10:00:00 AM#
Dim duration As New TimeSpan(7, 5, 0, 0)
startDateTime = startDateTime.Add(duration)
I would bind this single startDateTime to a StartDateControl & a
StartTimeControl using the formatting previously given so each control only
displays its part, taking into consideration the "other half" when I put the
values back together...
Alternatively If I really needed both StartDate & StartTime fields, I would
combine the two fields, add the duration, then split the sum. However I
would look at using a single field first!
Dim startDate As DateTime = #7/1/2004#
Dim startTime As DateTime = #10:00:00 AM#
Dim duration As New TimeSpan(7, 5, 0, 0)
Dim temp As DateTime =
startDate.Add(startTime.TimeOfDay).Add(duration)
startDate = temp.Date
startTime = DateTime.MinValue.Add(temp.TimeOfDay)
Or I may use a combination of the above, for example my Domain Object may
have a single startDateTime field, but a StartDate & a StartTime property,
where the properties operate on their respective half of the startDateTime
field...
Hope this helps
Jay
John said:
Hi
In my case the date and time are separate fields like that of an outlook new
appointment. So e.g startdate="18/07/2004" and start time = "13.00". Now I
need to add various time spans and get enddate & endtime as separate fields.
Thanks
Regards