I have 2 DateTime's:
DateTime beginDate = 2000/01/01 14:00
DateTime endDate = 2000/01/01 14:30
I calculate a timespan between these 2 hours:
TimeSpan span = endDate.Subtract(beginDate);
var myValue = beginDate.AddMinutes( span.Minutes ).TimeOfDay.Ticks
//Trying to get this equal to the endDate by using the beginDate + myValue
//I have to use myvalue, because this value comes from the DB and this piece
//of code sits in another class than the above code
DateTime otherDate = beginDate.Date.Add( new TimeSpan( myValue ) )
The Problem is I keep on getting 0:30 back and I should get back 14:30. I understand why, its because beginDate.Date gives you 2000/01/01 00:00, but I cant use beginDate.TimeOfDay.Add because it is a readonly field. How do I achieve that it only add the myValue to the time of the given date??