On Fri, April 14, 2006 1:24 pm, jonathan wrote: > is there a function to take a second count and return it as a > formatted difference? > > like a date_diff('H hours i',6133) > > that uses date()'s formatting. I think he means something not unlike: function human_time($seconds){ $result = " and " . ($seconds % 60) . " seconds"; $seconds = floor($seconds/60); $result = ($seconds % 60) " minutes $result"; $seconds = floor($seconds/60); $result = ($seconds % 24) " hours $result"; $seconds = floor($seconds/24); $result = ($seconds % 30) " days $result"; $seconds = floor($seconds/365); $result = ($seconds % 12) " months $result"; $seconds = floor($seconds/12); $result = "$seconds years $result"; return $result; } That, however, is probably not precisely what he wants, as it's WAY off in the months/years thing... :-) This WOULD be a nice function to have built-in, but, unfortunately, a big ol' can of worms is opened up for the months and at 365+ days -- namely that without a start-time, you can't tell how many years have passed because you won't know if it was a leap year or not... One has to wonder WHAT our ancestors where thinking when they decided to make months have different lengths days and this whole leap year thing... I mean, the cure is worse than the disease, no? Don't even get me started on daylight savings and 15 minute time-zones. :-) So maybe it could take an optional start-time and assuming dates in the Unix-time range of 1/1/1970 to MAX_INT do a credible job of it. Then you'd need directives sort of like date() has for whether to print out, say, "XX seconds" if the number is evenly divisible by 60, or whether to use 0, space, or no prefix for numbers < 10, plus... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php