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. 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.

  • SQL code

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 )!

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.