Created
February 24, 2015 08:27
-
-
Save dokuzsekiz/4c7e902c51a60cece31b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://www.calculatorsoup.com/calculators/time/decimal-to-time-calculator.php | |
| function decimalDayToTime($dec) { | |
| $hours = $dec*24/1; | |
| $stringArray = explode('.',$hours); | |
| $hour = $stringArray[0]; | |
| $min = '0.'.$stringArray[1]; | |
| $minutes= $min * 60 /1; | |
| $stringArray = explode('.',$minutes); | |
| $minute = $stringArray[0]; | |
| $secondString = '0.'.$stringArray[1]; | |
| $second = round($secondString * 60 / 1); | |
| if ($second = 60) { | |
| $minute++; | |
| $second = 0; | |
| } | |
| return $hour.':'.$minute.':'.$second; | |
| } | |
| echo decimalDayToTime(0.372222222222); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment