AlaK4X
Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64



Your IP : 18.117.232.108


Current Path : /var/www/lhjmq-records.qc.ca/public_html/administration/lib/
Upload File :
Current File : /var/www/lhjmq-records.qc.ca/public_html/administration/lib/time.lib.php

<?php
function fixTime($input){
	//Check the time format
	if(strpos($input, ":") === false){
		switch(strlen($input)){
			case 0:
			case 1:
			case 2:
				return "00:" . $input;
				break;
			case 3:
				return "0" . substr($input, 0, 1) . ":" . substr($input, 1, 2);
				break;
			case 4:
				return substr($input, 0, 2) . ":" . substr($input, 2, 2);
				break;
			case 5:
				return "0" . substr($input, 0, 1) . ":" . substr($input, 1, 2) . ":"  . substr($input, 3, 2);
				break;
			case 6:
				return substr($input, 0, 2) . ":" . substr($input, 2, 2) . ":"  . substr($input, 4, 2);
				break;
		}
	}else{
		return $input;
	}
}
function flipTime($input){
	//Flip the time to absolute format from 20:00
	$expl = explode(":", $input);
	if($expl[1] != 0){
		$expl[0] = 19 - $expl[0];
		$expl[1] = 60 - $expl[1];
	}else{
		$expl[0] = 20 - $expl[0];
	}
	return $expl[0] . ":" . $expl[1];
}
?>