Link to home
Start Free TrialLog in
Avatar of BrighteyesDesign
BrighteyesDesignFlag for Afghanistan

asked on

Show'Hode content depending on time - Hours & minutes

Thanks to the wonderful Ray Paseur I have a script working which hides content if it's after one o'clock.

 <?php if (date('H') < 13) : ?>

What I need to do now is change this to 1.30. Any ideas how i would change the code below to do this?

I've tried  <?php if (date('H') < 13.30) : ?> & <?php if (date('H') < 13.5) : ?> with no joy...
ASKER CERTIFIED SOLUTION
Avatar of Robert Saylor
Robert Saylor
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
$x = date('G.i') ;
if ($x < 13.5) {
 // do something
}

Open in new window

Try this... untested but probably OK in principle.

<?php if (date('H:i') < '13:30') : ?>

Ref: https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html