Ron Piggott wrote:
That strtotime is a neat little command.  With a bit more searching I found
that this works:

$expiry_date = strtotime("+21 days");
$expiry_date = date('Y-m-d', $expiry_date);
echo $expiry_date;

The computer couldn't cope with me doing it in just one line --- I got a
parse error.

the computer coped when I did it on oneline, maybe you had a typo or something:

echo date("Y-m-d", strtotime("+21 days"));

sidenote: I use doublequotes here because its easier when testing in a linux shell....but unless you need string interpolation its better to use single quotes for your strings.


----- Original Message -----
From: Calvin Lough <[EMAIL PROTECTED]>
To: Ron Piggott <[EMAIL PROTECTED]>; PHP DB <>
Sent: Wednesday, March 02, 2005 10:50 AM
Subject: Re: [PHP-DB] Expiry Date ($date function)

The strtotime function should work the best.

$add_twentyone = strtotime("+21 days");

I dont know if that will work or not. I just found that method in the
php doc and it looked interesting. Hopefully it will work for you.


On Wed, 2 Mar 2005 04:41:04 -0500, Ron Piggott

I figured out that the syntax below creates the date in the way it may


stored in a mySQL table:


Is there any way to add 21 days to this as an expiry date? For example


the date was March 20th 2005 21 days would be in April --- is there any


of dealing with this?


PHP Database Mailing List (
To unsubscribe, visit:

-- PHP Database Mailing List ( To unsubscribe, visit:

Reply via email to