Time period in php

Asked

Viewed 74 times

0

I have two doubts.

First, I have the opening and closing times of an establishment, and I have the current time, as I do an algorithm that calculates whether the establishment is open or closed and return a Boolean 'True' if it is open or Boolean 'False' if it’s closed.

The second, I want an event to expire, I create events for future days, I want my program to know that it already happened and stop displaying.

My program is done in PHP. Please help!

  • 1

    Related: http://answall.com/questions/20622/evento-expirates%C3%A7%C3%A3o-de-data-e-hora-php? Rq=1

  • 1

    Post something you’ve already done, so we can start helping, give an answer without even seeing what you’ve started.

  • Here’s the basic tool for this, and some examples of usage. Then, just adapt to the type of variable you are using to store the date and time: http://php.net/manual/en/control-structures.if.php . If this does not resolve, click [Edit] and add more details about your problem to the question. Reading suggestion, fundamental for better use of Stack Overflow in Portuguese: [Tour], [Ask] and Community FAQ.

1 answer

0

In the matter of dates: You can use the SQL "now()" function to work with periods of time.

you do a query by comparing the date of the event and place within an array, so you will only have the dates in the time period you want.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.