Serving The Planet

[Solved] Difference Between 2 Dates in Weeks in PHP

I’m trying to get something nerdy done
for http://www.DigitalNomad.Pro …

… something really simple.

So I thought.

Difference Between 2 Dates in Weeks

That doesn’t seem to be easy to do in PHP < 5.3.

And yes it has to be used on webservers prior to version 5.3 of PHP as well.

Been Googling for a hour and seen all them the wonderful solutions.

It should be just be possible right with a few lines instead of a whole page of code, right? Wrong.

http://www.developertutorials.com/tutorials/php/calculating-date-difference-more-precisely-in-php-71/

So then it hit me. Forget about weeks! I can calculate the difference in seconds between two dates and then divide by (60*60*24*7)!

http://www.pixel2life.com/publish/tutorials/190/calculate_the_number_of_days_weeks_years_between_two_user_inputted_dates/

http://akkikhambhata.wordpress.com/2012/02/21/php-calculate-difference-between-two-dates-secondsminuteshoursdaysweeksmonthsyears/

 

About Earnie Rhyker

tech pioneer | intellectual BadAss | ethical lifehacker | WordPress Developer & Polyglot | information activist | blogger | added value services provider | multimedia enthusiast | senior linux server administrator | geek | bitcoin investor | laptop entrepreneur | open source contributor | hackintosh fanatic | charity donator | accredited top MLM networker & internet marketer 2014-2016 @ BFH | digital expat

View All Posts

Communities I have been 'hanging out' regularly over the past two decades. 

Note: links go to my profile on those respective sites. Connect with me if you like.

 

Earn With Earnie

This site hasn't been updated since 2022. Visit my new blog -- EarnWithEarnie.com -- instead:

X
error: Content is DCMA protected !!