How does php determine whether the current time is within a certain time range?

Source: Internet
Author: User
Tags date now
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.