473,320 Members | 1,979 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Playing Syatem.DateTime.



Hello gurus,
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.
Many thanks in advance

J.B
Jul 21 '05 #1
3 1626
The irony that you've posted this dated 30th June...

Posting some sample code or something might help, and in a specific language
group.

But it sounds like you need some kind of validation function like
(psuedocode, and I'm a C++ programmer so forgive any oddities [oh , and I've
been awake for 36 hours so forgive any glaring errors :-) ] )

Boolean AllowBooking( DateTime dateTime )
{
// Check that the hour is before 11 or the booking date isn't tomorrow.
Some adjustment needed to prevent booking for today.
return ( TodaysDate.Time.Hour < 11 || ( todaysDate.Date.Day + 1 !=
dateTime.Date.Day ) );
}

HTH,

Steve

"bredal Jensen" <br******@jensen.dk> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...


Hello gurus,
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.
Many thanks in advance

J.B

Jul 21 '05 #2
well june 30 th was due to me playing my server date time which i posted
from...

"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
The irony that you've posted this dated 30th June...

Posting some sample code or something might help, and in a specific language group.

But it sounds like you need some kind of validation function like
(psuedocode, and I'm a C++ programmer so forgive any oddities [oh , and I've been awake for 36 hours so forgive any glaring errors :-) ] )

Boolean AllowBooking( DateTime dateTime )
{
// Check that the hour is before 11 or the booking date isn't tomorrow. Some adjustment needed to prevent booking for today.
return ( TodaysDate.Time.Hour < 11 || ( todaysDate.Date.Day + 1 !=
dateTime.Date.Day ) );
}

HTH,

Steve

"bredal Jensen" <br******@jensen.dk> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...


Hello gurus,
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.
Many thanks in advance

J.B


Jul 21 '05 #3
private static bool CheckReservationDate(DateTime ReservationDate) {
bool ret = false;
DateTime Current = DateTime.Now ;
if(Current.Hour >= 11) {
DateTime NowDateOnly = new DateTime(Current.Year, Current.Month,
Current.Day) ; //remove time
DateTime ReservationDateOnly = new
DateTime(ReservationDate.Year,ReservationDate.Mont h,ReservationDate.Day);
//remove time
TimeSpan t = ReservationDateOnly.Subtract(NowDateOnly) ;
ret = t.Days > 1; //any date after tomorrow is fine.
}
return ret;
}

"bredal Jensen" <br******@jensen.dk> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...


Hello gurus,
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.
Many thanks in advance

J.B

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Max M | last post by:
# -*- coding: latin-1 -*- """ I am currently using the datetime package, but I find that the design is oddly asymmetric. I would like to know why. Or perhaps I have misunderstood how it...
16
by: PK9 | last post by:
I have a string variable that holds the equivalent of a DateTime value. I pulled this datetime from the database and I want to strip off the time portion before displaying to the user. I am...
13
by: bredal Jensen | last post by:
Hello gurus, 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...
15
by: Fritz Switzer | last post by:
I'd like to have a string assigned the value of a DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM" format. For example: DateTime.Now.AddMinutes(30) returns "00:30" ...
6
by: Ante Perkovic | last post by:
Hi, How to declare datetime object and set it to my birthday, first or last day of this month or any other date. I can't find any examples in VS.NET help! BTW, what is the difference...
3
by: Hugh G. Johnson | last post by:
Hi, I have just installed a shopping cart system that is build using the asp.net 1.1 frame work and a SQL 2000 db. The production server is a WS03 box running IIS 6, SQL 2000 (sp3), and has...
9
by: Phil B | last post by:
I am having a problem with a datetime from a web services provider The provider is sending the following SOAP response <?xml version="1.0" encoding="utf-8"?> <soap:Envelope...
3
by: bredal Jensen | last post by:
Hello gurus, 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...
0
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.