Total newb question... lol, but how do I get this to work with a form... lol, very embarasing to ask this... "Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The following function converts minutes to years, monthes, weeks, days, > hours, minutes. For instance, 61 minutes would become "1 hour, one > minute". Before I use it, I want to make sure there are no stupid > mistakes. I can't find any, can any of you? > function min2ymwdhm($min){ > $a = array(); > $years = intval(intval($min) / 525600); > if($years > 0) $array[] = $years . ' year' . ($years == 1 ? '' : 's'); > $monthes = intval(intval($min) / 43200) % 12; > if($monthes > 0) $array[] = $monthes . ' month' . ($monthes == 1 ? > '' : 'es'); > $weeks = intval(intval($min) / 10080) % 4; > if($weeks > 0) $array[] = $weeks . ' week' . ($weeks == 1 ? '' : 's'); > $days = intval(intval($min) / 1440) % 7; > if($days > 0) $array[] = $days . ' day' . ($days == 1 ? '' : 's'); > $hours = intval(intval($min) / 60) % 24; > if($hours > 0) $array[] = $hours . ' hour' . ($hours == 1 ? '' : 's'); > $minutes = intval($min) % 60; > if($minutes > 0) $array[] = $minutes . ' minute' . ($minutes == 1 ? > '' : 's'); > return implode($array,', '); > } > > -- > The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. > >
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php