Re: $date("l-m");

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

 



is it possible for $mydata->lastinsalled to have YYYY-MM-DD format? ie: 2004-05-31

you can use strtotime to convert it to unix timestamp to compare...something like this:

$stamp = strtotime('2004-06-31'); // $mydata->lastinsalled

if($stamp >= strtotime('1 year ago'))
{
   echo 'less than 1 year';
}
else
{
   echo 'over 1 year';
}

otherwise its impossible to tell if it is over one year without knowing the day as well.. unless you guess and figure on the first of the month..

John Taylor-Johnston wrote:

$mydata->lastinsalled = "2004-05";

How can I determne if $mydata->lastinsalled is one year or more older than the current $date("l-m");

Anyting simple and over looked? I have been browsing the manual::
http://ca.php.net/manual/en/function.strtotime.php
http://ca.php.net/manual/en/function.date.php

John


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