Posts: 3,110
Location: Toronto, Ontario
|
To mimick the DateAdd function, you'll want to work with a timestamp. A timestamp is just the number of seconds since the UNIX epoch (Jan 1, 1970). So, for example, to add three days to the current date, just add the number of seconds in three days to the current timestamp:
PHP Code:
$timestamp = time() + (60 * 60 * 24 * 3);
That is the hard way, I thought I'd explain that so you know how timestamps work
The mktime() function allows you to specify a specific time through the list of it's arguments. You can use the date() function combined with the mktime function to achieve the same as we did above:
PHP Code:
$timestamp = mktime(0, 0, 0, date('m'), date('d') + 3);
Once you have your timestamp, you can pass it to the date function with whatever format string you want.
PHP Code:
echo date('m.d.y', $timestamp);
Hope that helps! 
|