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? How do I determine the time ?, WHERENOW () BETWEEN 'Program start time 'a php how to judge 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?
How do I determine the time?
------ Solution --------------------
Where now () BETWEEN 'Program start time 'AND 'Program end time ';
------ Solution --------------------
This has nothing to do with your SQL. Your node quota is not regular at present, even if it is possible to change in the future, as long as you add an expiration period in your node quota.
------ Solution --------------------
Lz is recommended to list the table in detail.
SQL code
SELECT * FROM 'table' WHERE CURRENT_TIME () between' start time 'AND 'End Time ';
------ Solution --------------------
Can a database store a region. End at the beginning. That's not enough?
------ Solution --------------------
If your project list is periodic, there will be multiple judgments.
Swtch ($ weeks ){
Case 1:
PM-> pm-> PM, PM-> PM c} (you can make corresponding judgments)
Case 2:
{--> A,--> B,--> D,-> C) (likewise)
}
------ Solution --------------------
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 ..
------ Solution --------------------
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
------ Solution --------------------
I agree that the answer on the 14th floor is the most reliable.