Great, your code seems to solve my problem.
Ánd i will happily use it.
By the way will the following work?
So far it seems to work. I'just afraid it may break down
for some combination.
if (DateTime.Now.AddHours(13).Day==bookDate.Day) { do not book}
Anyway i have a solution, your solution.
Many thanks...
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
bredal Jensen <br******@jensen.dk> wrote: 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))
{
...
}
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too