On 11 Mar 2001 10:25:25 -0800, FredrikAT <[EMAIL PROTECTED]> wrote:
>I have 2 dates...
>$start = "20010101";
>$end = "20010312";

Use mktime() (http://www.php.net/manual/en/function.mktime.php) on those
strings to convert them into Unix timestamps:

$start_time = mktime(0,0,0, 
        substr($start, 6, 2), 
        substr($start, 4, 2),
        substr($start, 0, 4)
); // mktime( hour, minute, second, day, month, year)

Since a Unix timestamp is just the number of seconds since a starting point,
you can get the elapsed number of seconds by substraing $start_time from
$stop_time; divide that by 86400 and you'll have the number of days.

You could also use the Calendar extension if you have that installed, since it
allows you to covert from several calendar systems into Julian Day counts,
which could be subtracted similarly. (See
http://www.php.net/manual/en/ref.calendar.php)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to