I need to show contents based on a specific date and time in a php page. I need to show content1 upto a certain date, content2 for a limited time (between 2 defined dates), and content3 after the expiry date and time. Moreover, I need the possibility of changing the timezone, so the time should be provided by the server.
What I got so far is the following:
<?php
$exp_date = "2009-07-20";
$exp_date2 = "2009-07-27";
$todays_date = date("Y-m-d");
$today = strtotime($todays_date);
$expiration_date = strtotime($exp_date);
$expiration_date2 = strtotime($exp_date2);
if ($expiration_date > $today)
{ ?>
<!-- pre-promotion week content -->
<?php } else if ($expiration_date2 > $today) { ?>
<!-- promotion week content -->
<?php } else { ?>
<!-- expired/post-promotion week content -->
<?php } ?>
The problem is that this script takes into account only the date and not the time.