1. ## Date Calculation

Hello guys,

I have a little situation that involves date calculation.

Lets say the given date is from January 5, 2009 to March 23, 2009

How can i calculate that from January 5 to January 31 is 27 days(include Jan 5) and
from Feb 1 to feb 28 is 28 days and
from march 1 to march 23 is 23 days???

Sorry but i'm a little confused and still more to learn

Thanks alot and more power!

2. Use strtotime() to convert the dates into timestamps (numbers of seconds)

Then subtract to get the number of seconds between the two dates

Divide that by 60 to get the number of minutes
Divide that by 60 to get the number of hours
Divide that by 24 to get the number of days

PHP Code:
``` \$date1 = "January 5, 2009";\$date2 = "March 23, 2009";\$difference = strtotime(\$date2) - strtotime(\$date1);echo "Number of days: " . (\$difference / 60 / 60 / 24);  ```

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•