Page 1 of 1
Convert current time and ANY time - how?
Posted: Sat Dec 11, 2010 12:56 pm
by simonmlewis
This seems to extract the time on the server into a PHP string.
How do you state a given time, and then convert that into a PHP string so it cna be queried?
For example. I want a button to appear only before 5pm. at 17:01 I want that button to disappear.
I theory I'd say:
get current time.
setQueryTime to 17:00.
If currentTime is <= QueryTime, then show button.
Else, do not show button.
That's basically it. Doing all that with a date is a doddle. But how do you do it with time??
Re: Convert current time and ANY time - how?
Posted: Sat Dec 11, 2010 1:57 pm
by jaceinla
Code: Select all
if(17 >= date('H')) //returns hour on a 24 clock
{
//do not show button
}
Re: Convert current time and ANY time - how?
Posted: Sat Dec 11, 2010 2:23 pm
by simonmlewis
Reading your code (which looks unbelievably simple), I think it says:
if '17' is less than (or =) the current hour, then do this, if it is more than (or =) the current hour, then do that.
Man I was expecting some long-winded code, but that is geniuuuuus. So thank you.