Re: Making several variables into 1 variable

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

 



On Tue, Jul 28, 2009 at 6:32 AM, Miller,
Terion<tmiller@xxxxxxxxxxxxxxxxxxxx> 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

Try:

$past_date = date("m/d/y", $pastDays)

Or even:

$past_date = date ("m/d/y", time() - 2592000)

(where 2592000 is 30 * 86400, and 86400 is the number of seconds in one day.)




-- 
Richard S. Crawford (rscrawford@xxxxxxxxxxxx)
http://www.mossroot.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)

-- 
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