On Wed, 15 May 2002, Devin Atencio wrote: > I want to a kewl script that will format time from seconds. I have a script > that returns the number of seconds a person has been an employee and > I want to format it in human readable format like: > > 1 year 6 months 14 days, etc.
Say you had 18001 seconds. How would you figure out how many minutes that was? Do you know how many seconds there are in a minute? And once you had the minutes, how would you figure out how many hours that was? Do you know how many minutes there are in an hour? I hate to be condescending, but I think they teach this sort of thing in school around age 7. Of course, you can only go up to weeks this way. It's not possible to accurately calculate months or years from an abstract number of seconds (without knowing the starting date and time) because months and years have varying lengths. You could average it out by saying a month is 30 days and a year is 365.25 days but that's ever so slightly off (only matters when you get into hundreds of years). miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php