Re: Making several variables into 1 variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2009-07-28 at 09:32 -0400, Miller, Terion wrote:
> I need to take this:
> 
>    $pastDays = strtotime("-30 days");
> 
> 
> 
> $past_day = date("d", $pastDays);
> 
> $past_month = date("m", $pastDays);
> 
> $past_year =date("y", $pastDays);
> 
> 
> And make it into one var to compare to a db field that is formatted like
> 00/00/00 
> 
> 
Erm, why don't you do this:

$pastDays = strtotime("-30 days");
$date = date("d/m/y", $pastDays);

The date() function allows you to mix in all sorts of characters into
the output it formats, and you can escape characters that have special
meaning with a slash '\' character.

Thanks,
Ash
http://www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux