Re: HELP!!! Date time problems!!!!

From: Date: Thu, 08 Mar 2001 18:43:03 +0000
Subject: Re: HELP!!! Date time problems!!!!
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-43088@lists.php.net to get a copy of this message
Yes, there was a little bug, it was set to handle date in yyyy/mm/dd and not dd/mm/yyy. Now this works ok. py 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*24*60 return ( $enddate - $startdate ) / ( 86400 ); } // end function echo diff_date("/", "05/03/2001" ) ; ----- Original Message ----- From: karakedi <eyilmaz76@ultratv.net> To: <php-general@lists.php.net> Sent: Thursday, March 08, 2001 11:01 PM Subject: Re: [PHP] HELP!!! Date time problems!!!! > figured out the logic, > but still cant make it run > > i put this command : > > echo diff_date("/", "05/03/2001") ; > > to test the function. but it doest seem to work :( > any help ? > > btw i believe it must be 24*60*60 inorder to 24*24*60 :) > > ""Pierre-Yves Lemaire"" <pylem@sympatico.ca> wrote in message > news:01c301c0a7e0$17f85f00$9ceee740@py... > > Hello, > > this is a function I use on my site, you can problably find > > your answer, > > py > > > > // ===================================================== > > // 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[2], > > $startdate[0] ); > > // Now > > $enddate = mktime( 0, 0, 0, date("n"), date("d"), date("Y") > > ); > > // get difference in days by dividing by 24*24*60 > > return ( $enddate - $startdate ) / ( 86400 ); > > } // end function > > > > > > ----- Original Message ----- > > From: Bruno Freire <bruno@fujinor.com.br> > > To: <php-general@lists.php.net> > > Sent: Thursday, March 08, 2001 7:05 PM > > Subject: [PHP] HELP!!! Date time problems!!!! > > > > > > > Hi, My name is Bruno, From Brazil..... > > > > > > Yes...it's me again...hehehe.... > > > > > > Look...my problem is.. > > > > > > I wanna make something like this: > > > > > > (10 november 2001) - (5 November 2001) = 5 days > > > > > > (10 november 2001) - (10 December 2001) = 30 days > > > > > > How can i do this???? > > > > > > > > > Thanks for any help!!!! > > > > > > Your friend, Bruno!!!! From !!!!! > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#43088) next »