Hi.
I am working with a time string that I want to be able to add a value to. If I enter a time of day as hhmm (example 2000), I would like to add a time value as hhmm (0535 + 2000 would return 0135) and return this as a string.
Can someone help me with an easy way to do this please?
Thanks.
My current routine doesn't work, but here is what I have done in sourcecode. The only part that seems to fail is the adding of hours and minutes to the time. Is there a shorter or better way to do this?
public
static string MinSearch(string MyTime, string MinConTime){
int MinMinutes;
int MinHours;string timestring="";
DateTime StartTime = Convert.ToDateTime(MyTime.Substring(0,2)+":"+MyTime.Substring(2,2));
MinMinutes =
Convert.ToInt32(MinConTime.Substring(2, 2));MinHours =
Convert.ToInt32(MinConTime.Substring(0, 2));StartTime.AddMinutes(MinMinutes);
StartTime.AddHours(MinHours);
timestring = StartTime.ToString().Substring(11, 2) + StartTime.ToString().Substring(14, 2)
;return (timestring);