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" <jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eJ*************@TK2MSFTNGP09.phx.gbl... * "John" <jo**@nospam.infovis.co.uk> scripsit: I have a start date and a start time field. I also have a timespan
value which can be anything from 5 minutes (TimeSpan(0, 5, 0)) to 2 weeks
(TimeSpan(14, 0, 0, 0)). How can I get an end date and end time (separate fields) by adding timespan to start date & start time?
\\\
Dim ts As TimeSpan = New TimeSpan(5, 0, 0, 0)
Dim dtm As Date = DateTime.Now
dtm = Date.op_Addition(dtm, ts)
///
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>