PHP date calculation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kahwooi
Forum Commoner
Posts: 25
Joined: Fri Dec 10, 2004 12:28 am

PHP date calculation

Post by kahwooi »

Hi all,

I am using php with firebird, I want to calculate the day different between 12/07/2005 and 05/20/2002. How to do it in php?

Thanks.
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post by AVATAr »

In the online documentation: [php_man]date[/php_man] and read user comments
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

If you want days, you could just convert both dates to timestamps, subtract the greater from the lesser, then convert the seconds back to days.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply