Re: Date Help Needed

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

 



Ron Herhuth wrote:
I am trying to construct a function where I feed it a number such as "x"
it returns the date "x" days ago.

<?php

$format = 'l dS of F Y h:i:s A';

/** Check that "now" relative time is ok, instead of midnight */
echo date($format, strtotime("now")) . "\n";

/** If now resolves correctly, then this should work */
$x = strtotime("-1 days");
echo date($format, $x);

?>


I tried checking out several resources that give you the difference between two dates, but not exactly what I was looking for. I was just hoping someone had a little algorithm in their bag of tricks.

Thanks,
Ron



--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY | http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux