Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HELP !!!

1 view
Skip to first unread message

Damian Brown

unread,
Jul 30, 2003, 2:54:03 PM7/30/03
to
www.phpexpert.org

help needed with php project
need to work out day difference in dates

Regards,
Damian
www.phpexpert.org
any UK programmers can ring me on
FREEphone 0800 019 0924


Werner Sandner

unread,
Aug 22, 2003, 10:04:53 AM8/22/03
to
I never found anything in php either so I came up with a workable solution:

The difference between one day and another is 86400. (In PHP it is).
So if we wanted to find out the difference between date1 and date2 we can do
following:
$date_diff_in_days = ($date1 - date2) / 86400;

This is how I tested it:
$date1 = strtotime("5 January 1990");
$date2 = strtotime("5 January 1991");
$date_diff_in_days = ($date2 - $date1) / 86400;
print "There are ".$date_diff_in_days;

As easy as.
Hope that helps. Let me know how you go.

Werner Sandner
http://www.supremweb.com
man...@supremweb.com
Cairns, North Eastern Australia

"Damian Brown" <dam...@bleachboys.com> wrote in message
news:bg948b$71h$1...@hercules.btinternet.com...

0 new messages