J
Jon Skeet [C# MVP]
bredal Jensen said:I'm building a small booking system and i have come accross quiet a tedious
pitfall.
"I need to make sure that people do not book for tomorrow when todays time
is greater or equal to 11."
Well some of you probably allready know the answer but this is not so
obvious for me.
Can anyone solve this puzzle for me?
The booking hour is of no importance. Only the hour at which we are making
this booking and only if it is the day after today.
if (DateTime.Now.Hour >= 11 && // If it's later than 11am today
// And the booking is after tomorrow midnight
booking >= DateTime.Today.AddDays(1) &&
// And the booking is earlier than 2 days hence midnight
booking < DateTime.Today.AddDays(2))
{
....
}