Link to home
Start Free TrialLog in
Avatar of Jeff Long
Jeff Long

asked on

Getting How Many Days Have Past Since a Certain Date

I need a simple function that will get the number of days that have past since a certain date.

For example:

Start date is 04/14/09 and it's stored in my DB in that format ("m/d/Y")
End date is TODAY or date("m/d/Y") - 05/18/09

$start = strtotime($date_joined);
$end = strtotime($today);
$days_past = {THIS IS WHAT I NEED TO KNOW}

How would I find out how many days have past since the start date?

All my dates are in the format of m/d/Y so I imagine I'd have to use strtotime right?

Please provide me a function that will accomplish this...I've looked and looked but cannot find anything that works.
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

you might start off here:
http://www.addedbytes.com/php/php-datediff-function
watch out to implement the improvements!
Avatar of Jeff Long
Jeff Long

ASKER

Sorry but that was not helpful and too confusing...someone else please help. Thanks.
ASKER CERTIFIED SOLUTION
Avatar of bored321
bored321
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you for not being lazy and providing me the exact function I needed. It worked perfectly!
bored321,

Thank you for providing me such a clear and direct solution to my problem.

It worked perfectly.

I knew it had to be WAY easier than that whirlwind of nonsense angelll sent me to.
Hi,

>Thank you for not being lazy and providing me the exact function I needed. It worked perfectly!
just to explain why I posted the link, and not the exact function:
* the function shall be helpful in many situations in your near and far future.
* you claim me to be lazy, but you don't seem to know me...
* if I posted "helpful" links, so you can work out your solution, is better for you, as this chinese proverb goes:
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.

CHeers
Yeah that wasn't kind of me...I apologize :)

I'm sure you not lazy.  Thanks for wanting to help me I just couldn't make heads or tails of the solution you provided.

God Bless!
no harm done.
CHeers