Solved

Show'Hode content depending on time - Hours & minutes

Posted on 2013-06-27
3
215 Views
Last Modified: 2013-06-27
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...
0
Comment
Question by:BrighteyesDesign
3 Comments
 
LVL 7

Accepted Solution

by:
Robert Saylor earned 500 total points
ID: 39281220
try H.i instead of H
0
 
LVL 9

Expert Comment

by:TvMpt
ID: 39281223
$x = date('G.i') ;
if ($x < 13.5) {
 // do something
}

Open in new window

0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 39281228
Try this... untested but probably OK in principle.

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

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question