Click to See Complete Forum and Search --> : If the time now is a new hour then...


dan.coop3r
11-07-2007, 09:34 AM
Hi,

Im trying to think of a way to write a piece of code that basiaclly does this.

If the time now is a new hour then...
If the time now is a new day then...
if the time is a new week then...
if the time now is a new month then...

once I have that I can create mysql tables at the right time to store data.

Thanks in advance!

cridley
11-07-2007, 11:16 AM
<?php
$now = getdate();
if ($now["hours"] > $stored_hour) { ... }
if ($now["mday"] > $stored_hour) { ... }

....
?>

month returns a string eg "November" and so does weekday (eg "Wednesday"), so you need to compare those differently.