This is actually a nice example of why it would be better to have type declaration on the variables.
Calculating with dates is easier if PHP knew that the var you throw at it is a date. So if you've got: date $date1 date $date2 and then do $result = $date2 - $date1 PHP would know how to subtract two dates and return the serial (in theory, if it had type declaration). It's how I always do it in Excel (where I do alot of date calculations), and it seems weird to have type declaration and automated date calc in something as simple as VBA (and VB), and not having it in PHP, which in so many ways are far more advanced. When you store a date in a date variable in VB (believe Java also does it this way), it's actually stored as a serial number relative to the number of days passed since 1 Jan 1900 (dates before that are negative). Hours, mins, and so on, are converted to fractions of a day and put after the decimal point ... Then you can do whatever math on it without having to convert it back on forth. You'd then only have to convert them for the sake of echo-ing or storing in DB. Just my 2 € Rene On Wed, 12 Mar 2003 18:22:46 +0100, Marek Kilimajer wrote about "Re: [PHP] RE: Calculates time elapsed between two date" what the universal translator turned into this: >Get timestamp of these dates, subtract them and use math to find out >days, hours etc from the difference > >YC Nyon wrote: > >>Hi, >> >>I need to get the time/date (ie. 1 day 12 hours 11 min 4sec) between 2 time >>dates. >>Can't seem to find any of these functions in the PHP manual. >> >>Thanks >>Nyon -- Rene Brehmer This message was written on 100% recycled spam. Come see! My brand new site is now online! http://www.metalbunny.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php