I'm an experienced PHP user, but I have never quite grasped mktime.. How do I use mktime to generate a timestamp which is one month in the future?
You don't need to use mktime for this. $now = time(); $seconds_in_a_month = 60 * 60 * 24 * 31; $one_month_in_the_future = $now + $seconds_in_a_month; Code (markup): All you do is add the number of seconds in a month to the current timestamp and it will give you a timestamp for one month in the future. An example of when you might use mktime() is if the user has selected the day month and year from a dropdown and you want to convert it into a timestamp before storing it in a database: // Let's just pretend you've already validated your form data $birthday = mktime(0, 0, 1, $_POST['month'], $_POST['day'], $_POST['year']); Code (markup):
<?php $next_month = mktime(0,0,0,date("m")+1,date("d"),date("Y")); echo "In one month's time, it will be: ".date("D / M / Y", $next_month); ?> PHP: