jugaad Posted December 3, 2008 Share Posted December 3, 2008 i am posting a small code, please let me know if i need to add seconds in this strings, how it gonna work? what is the right way to show here (string) $display_output = null; (string) $minute = 60; (string) $seconds = ????????????????????????? (string) $hour = 60 * $minute; (string) $day = 24 * $hour; Link to comment https://forums.phpfreaks.com/topic/135273-what-for-seconds-pls-help/ Share on other sites More sharing options...
dclamp Posted December 3, 2008 Share Posted December 3, 2008 Im a little confused as to what your code is doing... You dont need to declare (string) if you are setting it right there. Link to comment https://forums.phpfreaks.com/topic/135273-what-for-seconds-pls-help/#findComment-704577 Share on other sites More sharing options...
jugaad Posted December 3, 2008 Author Share Posted December 3, 2008 here is code for more details: i am playing with seconds, and you can see second code there, but i know its not right, i am really new to this: Please help function time_difference ($end_date, $start_date = CURRENT_TIME) { return ($end_date - $start_date); } function time_left($end_date, $start_date = CURRENT_TIME) { (string) $display_output = null; (string) $second = ?????????? (string) $minute = 60; (string) $hour = 60 * $minute; (string) $day = 24 * $hour; $time_left = $end_date - $start_date; $days_left = floor($time_left/$day); $hours = $time_left - ($days_left * $day); $hours_left = floor($hours/$hour); $minutes = $hours - ($hours_left * $hour); $minutes_left = floor($minutes/$minute); $seconds = $minutes - ($minutes_left * $hour); $seconds_left = floor($seconds/$second); if ($time_left > 0) { $display_output = (($days_left>0) ? '<span>'.$days_left . ' ' . (($days_left==1) ? GMSG_DAY : GMSG_DAYS) . ', ' : '<span class="redfont">') . (($hours_left>0 || $days_left>0) ? $hours_left . GMSG_H : '') . ' ' . $minutes_left . GMSG_M . ' ' . $seconds_left . GMSG_S . '</span>'; } else { $display_output = GMSG_CLOSED; Link to comment https://forums.phpfreaks.com/topic/135273-what-for-seconds-pls-help/#findComment-704578 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.