17:47:02 by
K3YL3SS | Views: 73 | Comments: 0
If your site focuses on a specific event such as Christmas or your wedding, you may want to have a count down to let users know how long it will be until the event occurs. We can do this using timestamps and the mktime function.
Let's get goingFirst we need to set our target date. For our example we will use February 10th, 2007. We would get that with this line:
$target = mktime(0, 0, 0, 2, 10, 2007);Next we need to get the current date. We can do that with this line:
$today = time ();We now have to find the difference between them. To do that we simply need to subtract:
$difference = ($target-$today);Since the timestamp is measured in seconds, we conv
...