Gossamer Forum
Home : Products : DBMan : Customization :

Re: Search time on the time of the search

Quote Reply
Re: Search time on the time of the search In reply to
First I need you to decide exactly what the field names will be. The whole rest of the code depends on it. You have several different structures here:

Mon_open
rMon_open
Office_mon_open
Hotline_mon_open

I need to know *exactly* what the fields are going to be, including the case of the field names. So, decide what you want to end up with and we'll work from there. Smile

I'm not sure why you have both Mon_open and rMon_open. I need an explanation of that.

The next thing we'll need to do is to convert the data from your select fields into the correct format for the database. "Closed" would be -2 for both "open" and "close" times. "24 Hours" would have to be -1 for open time and 2400 for close time. Hmmmm. I'm thinking about this as I go along. I just realized that the script searches for "greater than" and "less than" but not "greater than or equal to." So we have to fudge the numbers a little bit so the times will come out right.

(I know this is different than I said before. This is all new to me, so I have to play it by ear. Smile)

When the search is done (eventually), the script will figure out what day it is so it can look in the right field. Then it will figure out what time it is and search for "day_open" that is less than the current time and "day_closed" that is greater than the current time. That's how you will get your results.

As for converting military time to "regular" time -- it would go something like this:

Code:

if ($time == 0) {
$output = "12:00 midnight";
}
elsif ($time < 100) {
$min = $time;
if ($min<10) { $min = "0" . $min; }
$output = "12:" . $min . " a.m.";
}
elsif ($time < 1200) {
$min = $time % 100;
if ($min < 10) { $min = "0" . $min; }
$output = int($time/100) . ":" . $min . " a.m.";
}
elsif ($time == 1200) {
$output = "12:00 noon";
}
elsif ($time < 1300) {
$min = $time-1200;
if ($min < 10) { $min = "0" . $min; }
$output = "12:" . $min . " p.m.";
}
elsif ($time < 2400) {
$time -= 1200;
$min = $time % 100;
if ($min < 10) { $min = "0" . $min; }
$output = int($time/100) . ":" . $min . " p.m.";
}
else { $output = "12:00 midnight"; }
This probably would be best to put into a subroutine to be called whenever you needed it. But you're not quite ready for this as yet. You gotta decide for certain about those field names first.

JPD
http://www.jpdeni.com/dbman/
Subject Author Views Date
Thread Search time on the time of the search wangs 4038 Jul 3, 2000, 2:05 AM
Thread Re: Search time on the time of the search
JPDeni 3955 Jul 3, 2000, 3:18 AM
Thread Re: Search time on the time of the search
wangs 3940 Jul 3, 2000, 8:01 PM
Thread Re: Search time on the time of the search
JPDeni 3954 Jul 4, 2000, 1:33 AM
Thread Re: Search time on the time of the search
wangs 3939 Jul 4, 2000, 2:49 AM
Thread Re: Search time on the time of the search
JPDeni 3914 Jul 4, 2000, 4:31 AM
Thread Re: Search time on the time of the search
wangs 3944 Jul 4, 2000, 6:20 AM
Thread Re: Search time on the time of the search
JPDeni 3933 Jul 4, 2000, 6:49 AM
Thread Re: Search time on the time of the search
wangs 3925 Jul 4, 2000, 3:31 PM
Thread Re: Search time on the time of the search
JPDeni 3919 Jul 5, 2000, 10:04 AM
Thread Re: Search time on the time of the search
wangs 3941 Jul 5, 2000, 11:24 AM
Thread Re: Search time on the time of the search
JPDeni 3927 Jul 5, 2000, 11:36 AM
Thread Re: Search time on the time of the search
wangs 3909 Jul 5, 2000, 11:52 AM
Thread Re: Search time on the time of the search
wangs 3924 Jul 5, 2000, 11:54 AM
Thread Re: Search time on the time of the search
wangs 3940 Jul 5, 2000, 12:00 PM
Thread Re: Search time on the time of the search
JPDeni 3917 Jul 5, 2000, 12:08 PM
Post Re: Search time on the time of the search
wangs 3917 Jul 5, 2000, 12:14 PM