RE: [PHP-WIN] compare and get difference between two dates

From: Date: Mon, 14 Jan 2002 00:07:24 +0000
Subject: RE: [PHP-WIN] compare and get difference between two dates
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-11415@lists.php.net to get a copy of this message
From the manual: see the time functions at http://www.php.net/manual/en/ref.datetime.php specifically the gmmktime() function. Give it a date and it will tell u how many seconds have elapsed since after the Unix Epoch (1/1/1970 00:00). So gmmktime both the dates in question and you'll have two values in seconds. Subtract to get the number of seconds between them. Working out the days etc is just simple maths after that. Asking for the number of months to be included is ambiguous, how long is a month?... :) R -----Original Message----- From: Byron Bignell [mailto:byron@bignell.com] Sent: 13 January 2002 20:59 To: php-windows@lists.php.net Subject: [PHP-WIN] compare and get difference between two dates Ok. New as I am to PHP I need to ask this. How does one compare two dates and return the difference in years, months, days, hours, minutes and seconds? Byron \/ @@||=- -=|| bEe ||=- *----------------------------------* | >> The Virtual Village BBS | | >> Coming back soon. Stay tuned. | *----------------------------------* --> Nature hates to vacuum. <--

« previous php.windows (#11415) next »