|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Time() and days
<i><b>Originally posted by : Kev (kev_1w@yahoo.co.uk)</b></i><br /><br />I need to determine if the current date is between two specified dates (from a database, in the format 14:14).<br />The dates are restaurant opening and closing times...<br />The problem Ive got is when one of the restaurants closes the following day, ie.<br /> Rs("Friday_Open")="11:00" and<br />Rs("Friday_Closed")="03:00"<br /><br />The restaurant opens at 11 o'clock and closes the following day, at three o'clock in the morning...<br /><br />This means that the current time ( Time() ) is not between these two values<br /><br />I tried the following.....<br /><br />normClose = CDate(Rs("Friday_Closed"))<br /> If normClose >= CDate("00:00") then<br /> normClose = DateAdd("d", 1, normClose)<br /> End If<br /><br />..... with no success!<br /><br />Any help would be much appreciated!<br /><br />Kev.<br />
|
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : NesKen</b></i><br /><br /><br />Okay well in the second example you have<br /><br />normClose = CDate(Rs("Friday_Closed"))<br /> If normClose >= CDate("00:00") then<br /> normClose = DateAdd("d", 1, normClose)<br /> End If<br /><br />The second line NormClose >= 00:00...<br /><br />this will ALWAYS be true, how do you have a negative time???<br /><br />Proposed solution.<br /><br />if normclose <= CDate(rs("Friday_Open"))<br /><br />Now you know if it is less (If you are using military time which I assume you are.. if not let me know I will look back in a few minutes<br /><br /><br />------------<br />Kev at 5/26/2000 10:08:43 AM<br /><br /><br />I need to determine if the current date is between two specified dates (from a database, in the format 14:14).<br />The dates are restaurant opening and closing times...<br />The problem Ive got is when one of the restaurants closes the following day, ie.<br /> Rs("Friday_Open")="11:00" and<br />Rs("Friday_Closed")="03:00"<br /><br />The restaurant opens at 11 o'clock and closes the following day, at three o'clock in the morning...<br /><br />This means that the current time ( Time() ) is not between these two values<br /><br />I tried the following.....<br /><br />normClose = CDate(Rs("Friday_Closed"))<br /> If normClose >= CDate("00:00") then<br /> normClose = DateAdd("d", 1, normClose)<br /> End If<br /><br />..... with no success!<br /><br />Any help would be much appreciated!<br /><br />Kev.<br />
|
|
#3
|
|||
|
|||
|
<i><b>Originally posted by : Kev (kev_1w@yahoo.co.uk)</b></i><br />Well, I was given the database full of restauraunt opening and closing times, which the client has entered...<br />For each restaurant I have an opening time and a closing time, I need to see if the restaurant is open at the time the visitor requests the page.<br />some restaurants open in the afternoon and dont close till three o'clock in the morning, so I have..<br />Rs("Friday_Open") <<< which is = 14:00 and<br />Rs("Friday_Closed") <<< which is = 03:00<br /><br />Rs("Friday_Closed") is = 03:00 on the same day<br /><br />I need to say...<br />-------------------------<br />If Time() >= Rs("Friday_Open") And Time() <= Rs("Friday_Closed") Then<br />---do something here--<br />End If<br />-------------------------<br /><br />It wont work because it is like saying the restaurant opens at 2 o'clock in the evening, but it closed at 3 o'clock that morning..<br /><br />I hope you follow!<br /><br />so I tried to add 1 day to this value if it was over 00:00 ....<br />Thats what this was for...<br />-------------------------<br /> If normClose >= CDate("00:00") then<br /> normClose = DateAdd("d", 1, normClose)<br /> End If<br />-------------------------<br /><br />A bit confusing, and its got me,<br /><br />Kev.<br /><br /><br />------------<br />NesKen at 5/26/2000 1:54:22 PM<br /><br /><br /><br />Okay well in the second example you have<br /><br />normClose = CDate(Rs("Friday_Closed"))<br /> If normClose >= CDate("00:00") then<br /> normClose = DateAdd("d", 1, normClose)<br /> End If<br /><br />The second line NormClose >= 00:00...<br /><br />this will ALWAYS be true, how do you have a negative time???<br /><br />Proposed solution.<br /><br />if normclose <= CDate(rs("Friday_Open"))<br /><br />Now you know if it is less (If you are using military time which I assume you are.. if not let me know I will look back in a few minutes<br /><br /><br />------------<br />Kev at 5/26/2000 10:08:43 AM<br /><br /><br />I need to determine if the current date is between two specified dates (from a database, in the format 14:14).<br />The dates are restaurant opening and closing times...<br />The problem Ive got is when one of the restaurants closes the following day, ie.<br /> Rs("Friday_Open")="11:00" and<br />Rs("Friday_Closed")="03:00"<br /><br />The restaurant opens at 11 o'clock and closes the following day, at three o'clock in the morning...<br /><br />This means that the current time ( Time() ) is not between these two values<br /><br />I tried the following.....<br /><br />normClose = CDate(Rs("Friday_Closed"))<br /> If normClose >= CDate("00:00") then<br /> normClose = DateAdd("d", 1, normClose)<br /> End If<br /><br />..... with no success!<br /><br />Any help would be much appreciated!<br /><br />Kev.<br />
|
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > Time() and days |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|