1 | <?php |
||
30 | class Date |
||
31 | { |
||
32 | |||
33 | /** |
||
34 | * Constant for the number of seconds in a day |
||
35 | * |
||
36 | * @var integer DAY_IN_SECONDS |
||
37 | */ |
||
38 | const DAY_IN_SECONDS = 86400; |
||
39 | |||
40 | /** |
||
41 | * Constant for the number of seconds in an hour |
||
42 | * |
||
43 | * @var integer HOUR_IN_SECONDS |
||
44 | */ |
||
45 | const HOUR_IN_SECONDS = 3600; |
||
46 | |||
47 | /** |
||
48 | * Constant for the number of seconds in a minute |
||
49 | * |
||
50 | * @var integer MINUTE_IN_SECONDS |
||
51 | */ |
||
52 | const MINUTE_IN_SECONDS = 60; |
||
53 | |||
54 | /** |
||
55 | * Formats a timespan into a string of the format 0d 0h 0m |
||
56 | * |
||
57 | * @param integer $timespan The timespan in seconds to format |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | public static function secondsToUnits($timespan) |
||
77 | |||
78 | /** |
||
79 | * Formats a timespan into a string of the format 0d 0h 0m |
||
80 | * |
||
81 | * @param integer $timespan The timespan in seconds to format |
||
82 | * @param integer $interval The interval in seconds to round against |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | public static function roundByInterval($timespan, $interval, $enforceMinimum = true) |
||
109 | } |
||
110 |