A person will save a mealTime in my SQL database. I need to stop a second person to log a mealtime within 45 minutes of a time in database. I'm using C#. (Still learning C#) I've tried TimeSpan. Yes I can add 45min to a time but how do I check if a time is falling within a 45 min period. Please if someone can help me out.
TimeSpan MyTime = TimeSpan.Parse(txtTime.Text);
TimeSpan endTime = TimeSpan.FromMinutes(45);
TimeSpan TS = MyTime + endTime; ///Here I add the 45 min to entered time
if (MyTime < EndTime
{
//MyTime will always be smaller
}
else if (MyTime > EndTime
{
//EndTime will always be bigger
}
//Just cant get around this!