src/util/Date.php
public static function adjust($hour, $ampm) {
        $hour = (int)$hour;
        $ampm = strtolower($ampm);

        switch ($ampm) {
            case 'am':
                if ($hour == 12) {
                    $hour = 0;
                }
                break;
            case 'pm':
                if ($hour < 12) {
                    $hour += 12;
                }
                break;
        }

        return sprintf('%02d', $hour);
    }
public static function adjust($hour, $ampm) {
        $hour = (int)$hour;
        $ampm = strtolower($ampm);

        switch ($ampm) {
            case 'am':
                if ($hour == 12) {
                    $hour = 0;
                }
                break;
            case 'pm':
                if ($hour < 12) {
                    $hour += 12;
                }
                break;
        }

        return sprintf('%02d', $hour);
    }
public static function adjust ( $ hour , $ ampm ) { $ hour = ( int ) $ hour ; $ ampm = strtolower ( $ ampm ) ; switch ( $ ampm ) { case 'am' : if ( $ hour == 12 ) { $ hour = 0 ; } break ; case 'pm' : if ( $ hour < 12 ) { $ hour += 12 ; } break ; } return sprintf ( '%02d' , $ hour ) ; }
Adjusts a non-24-hour number into a 24-hour number.

$hour = Date::adjust(3, 'pm'); // 15

@param   integer $hour hour to adjust
@param   string $ampm AM or PM
@return  string
Adjusts a non - 24 - hour number into a 24 - hour number .