How does php determine whether the current time is within a certain time range? I have a function to output the contents of the day.
How does php determine whether the current time is within a certain time range?
I have a function to output the contents of the day ..
It mainly includes the program name program introduction, program start time, and program end time ..
How can I determine which one outputs the current time?
Lz is recommended to list the table in detail.
SELECT * FROM 'table' WHERE CURRENT_TIME () between' start time 'AND 'End Time ';
Can a database store a region. End at the beginning. That's not enough?
If your project list is periodic, there will be multiple judgments.
Swtch ($ weeks) {case--> a,--> B, AM-am-> c} (make the appropriate judgment) case 2: {am-> a, AM-am-> B, AM-am-> D, AM-am-> C)} (likewise )}
Why is it so tangled...
The festival schedule is regular, right? As long as the start time of each program is recorded in the database, expressed as unixtimestamp, as long
Show start <current time <is the end of the program?
Then you can regularly fill in the node quota ..
You gave the table structure early, and the problem was solved long ago!
Current date now ()
Weekday (now () of today's week ())
Which programs are broadcast today? find_in_set (weekday (now (), 'Week '). Note that your week field name is reserved for mysql.
Current time curtime ()
The time range in which the current time is curtime () between start_time and finish_time
Combined
select * from tbl_name where find_in_set(weekday(now()),`week`) and curtime() between start_time and finish_time
The above is how php judges the content of the current time in a certain time range. For more information, please follow the PHP Chinese network (www.php1.cn )!