|
Posted by Rami Elomaa on 06/14/07 18:48
howzit kirjoitti:
> I have a set date in my MySQL database that records when a Sales Lead
> is established and I echo that date as $row_rsLead['lead_date'];
>
> I need to be able to calculate how many days that lead has existed.
> $row_rsLead['lead_date']; outputs as 2007-06-14.
>
> I have made numerous attempts to create a function that will calculate
> the days between the lead_date and today's date, but have made
> absolutely no headway. I am either stuck working between differing
> date formats or really strange numerical outputs.
>
> If there is a script someone is willing to share or point me in a
> direction that is good for a relative newcomer to PHP, I would be most
> grateful.
>
> Thanks folks.
>
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_datediff
SELECT DATEDIFF(lead_date, NOW()) AS days
Or something like that. Next time RTFM before asking.
--
Rami.Elomaa@gmail.com
"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
Navigation:
[Reply to this message]
|