Solved

Show'Hode content depending on time - Hours & minutes

Posted on 2013-06-27
3
212 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 6

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 108

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now