Re: HELP!!! Date time problems!!!!
| From: | karakedi | Date: | Thu, 08 Mar 2001 23:22:03 +0000 |
| Subject: | Re: HELP!!! Date time problems!!!! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43085@lists.php.net to get a copy of this message | ||
ok here is the right one working : smt was wrong with the arrays i beleive :
<?php
// =====================================================
// This function returns the difference between a dates
// and the current date.
// arg1: separator
// arg2: startdate date dd mm yyyy
// return number of days of differences
// ======================================================
function diff_date( $sep, $startdate ){
// Date of file in database
$startdate = explode( "$sep", $startdate );
$startdate = mktime( 0, 0, 0, $startdate[1], $startdate[0],
$startdate[2] );
// Now
$enddate = mktime( 0, 0, 0, date("n"), date("d"), date("Y") );
// get difference in days by dividing by 24*60*60
return ( $enddate - $startdate ) / ( 86400 );
} // end function
echo diff_date("/", "05/3/2001") ;
?>
this one works :)