[PHP] HELP!!! Date time problems!!!!

2001-03-08 Thread Bruno Freire

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   !



Re: [PHP] HELP!!! Date time problems!!!!

2001-03-08 Thread Pierre-Yves Lemaire

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 
// 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 [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] HELP!!! Date time problems!!!!

2001-03-08 Thread karakedi

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"" [EMAIL PROTECTED] wrote in message
01c301c0a7e0$17f85f00$9ceee740@py">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 
 // 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 [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
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]




Re: [PHP] HELP!!! Date time problems!!!!

2001-03-08 Thread karakedi

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 
// 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 :)




-- 
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]




Re: [PHP] HELP!!! Date time problems!!!!

2001-03-08 Thread Pierre-Yves Lemaire

Yes, there was a little bug, it was set to handle date in /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 [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
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"" [EMAIL PROTECTED] wrote in message
 01c301c0a7e0$17f85f00$9ceee740@py">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 
  // 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 [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  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: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



 --
 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]




-- 
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]




Re: [PHP] HELP!!! Date time problems!!!!

2001-03-08 Thread karakedi

upss sorry couldnt see your latest post.
thx anywy :))


""karakedi"" [EMAIL PROTECTED] wrote in message
98942f$qcd$[EMAIL PROTECTED]">news:98942f$qcd$[EMAIL PROTECTED]...
 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 
 // 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 :)




 --
 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]




-- 
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]