RE: [PHP] Converting dates?

2001-11-17 Thread Jack Dempsey

search the archives there are tons of messages dealing with date
manipulation.
basically take the timestamps find the difference in seconds, convert to
days, etc

jack

-Original Message-
From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 17, 2001 3:17 PM
To: PHP is not a drug.
Subject: [PHP] Converting dates?


I am storing a birthdate in my database as a Unix timestamp but when I
display it I want to calculate the different between that date and todays
date and display the persons age.

How can I do that with PHP?

I also want to know if it is currently their birthday.  So trying to set
$isbday to yes if todays month and day are the same as their birthdate in
the database.

Jeff


--
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] Converting dates?

2001-11-17 Thread Jeff Lewis

Yes thanks for that, I already have this but am having a brain cramp on how
to obtain years.

function datediff($now, $old)
{
  /
  $DIS = $now - $old; // Diff In Secs
  $secs = $DIS % 60; // modulo
  $DIS -= $secs;
  $days = floor($DIS / (24*60*60));
  $DIS -= $days * (24*60*60);
  $hours = floor($DIS / (60*60));
  $DIS -= $hours * (60*60);
  $mins = floor($DIS / 60);
  $DIS -= $mins * 60;
  $diffstr= $days Days, $hours Hours, $mins Minutes, $secs Seconds;
  return $days;
}
- Original Message -
From: Jack Dempsey [EMAIL PROTECTED]
To: Jeff Lewis [EMAIL PROTECTED]; PHP is not a drug.
[EMAIL PROTECTED]
Sent: Saturday, November 17, 2001 3:30 PM
Subject: RE: [PHP] Converting dates?


 search the archives there are tons of messages dealing with date
 manipulation.
 basically take the timestamps find the difference in seconds, convert to
 days, etc

 jack

 -Original Message-
 From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, November 17, 2001 3:17 PM
 To: PHP is not a drug.
 Subject: [PHP] Converting dates?


 I am storing a birthdate in my database as a Unix timestamp but when I
 display it I want to calculate the different between that date and todays
 date and display the persons age.

 How can I do that with PHP?

 I also want to know if it is currently their birthday.  So trying to set
 $isbday to yes if todays month and day are the same as their birthdate in
 the database.

 Jeff


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