sandy1028 Posted September 11, 2007 Share Posted September 11, 2007 Hi, I am facing problem in converting to time. select sec_to_time(unix_timestamp(now())-unix_timestamp(timestamp)) from Tablename where name= '".$name."'"; Here when values exceeds 838:59:59 how to get the exact value of time. Other than sec_to_time() is there any other function which gives the exact value Link to comment https://forums.phpfreaks.com/topic/68811-time-problem/ Share on other sites More sharing options...
sandy1028 Posted September 11, 2007 Author Share Posted September 11, 2007 Please help me how to convert seconds to Number of days, hours and min. Is there any built-in function Link to comment https://forums.phpfreaks.com/topic/68811-time-problem/#findComment-345868 Share on other sites More sharing options...
Aeglos Posted September 11, 2007 Share Posted September 11, 2007 I you want to convert an amount of seconds into hours:minutes:seconds try this: <?php function foo($seconds) { $hours = floor($seconds/3600); $timeleft = $seconds - ($hours*3600); $minutes = floor($timeleft/60); $seconds = $timeleft - ($minutes*60); echo $hours.':'.$minutes.':'.$seconds; } ?> There's bound to be some better way to do this, and you'll probably have to modify it to use it in... whatever is it that you need it... but I really didn't catch entierely what you were trying to do anyway Cheers. Link to comment https://forums.phpfreaks.com/topic/68811-time-problem/#findComment-345874 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.