Try to search your question here, if you can't find : Ask Any Question Now ?

How to express the difference between two dates in a human-readable format

HomeCategory: stackoverflowHow to express the difference between two dates in a human-readable format
Avatarpragati asked 5 months ago

If I have two dates – $end_date and $start_date, how can I express the difference between the two in a format such as “2 Years : 4 Months : 2 Days”?

I know that I can get the difference between the two dates like so:

$dif=strtotime($end_date)-strtotime($today);

But how can I convert that result into the human-readable format, like that shown above?

1 Answers
Best Answer
AvatarJyoti answered 5 months ago
Your Answer

12 + 1 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com