A countdown script that tell you how many days, hours, mins, secs are left to your target. Target Date & Target Time supported, also 12 hours format or 24 hours format supported also.
Time Left - A function to find out how many days, hours, secs, mins that is left until the target I was very sad with most of the countdown scripts that I had found that was for php because they didn't support time for the target. So I needed one very bad and I have looked all over and didn't find one that would do what I wanted, so I created this one that really works. All you have to do is call the function time_left($target_month, $target_day, $target_year, $target_hour, $target_min, $target_sec, $target_am_pm) and it will return the time that it is left until the target. It supports both 12 or 24 hours format. To use the 12 hour format, enter AM or PM in the $target_am_pm. When using the 12 hour format, you can only enter 1 - 12 in the field. To use the 24 hour format, leave the $target_am_pm blank. When using the 24 hour format, you can only enter 0 - 23 in the field.
Error Codes -1 = There's no time left to the target. -2 = Error: Month Format Incorrect (Must be in the 1 - 12 range) -3 = Error: Day Format Incorrect (Must be in the 1 - 31 range) -4 = Error: Year Format Incorrect (Must be at least 4 chars long and it must be in the 1950 - 2050 range) -5 = Error: Hour Format Incorrect (If using 12 hour format, must be in the 1 - 12 rnage, if using 24 hour format, must be in the 0 - 23 range) -6 = Error: Min Format Incorrect (Must be in the 0 - 59 range) -7 = Error: Sec Format Incorrect (Must be in the 0 - 59 range)
if ($time_left["days"] < 0 or $time_left["hours"] < 0 or $time_left["mins"] < 0 or $time_left["secs"] < 0) { return _Time_Left_In_Target; } else { return $time_left; } }
?>
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.