mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
35 lines
1005 B
PHP
Executable File
35 lines
1005 B
PHP
Executable File
<?php
|
|
// app/Helpers/info_helper.php
|
|
use CodeIgniter\CodeIgniter;
|
|
|
|
function float_seconds_to_hhmm_string(?float $time):?string
|
|
{
|
|
$time_str = null;
|
|
if($time){
|
|
$time_str = sprintf("%02d:%02d",$time/3600,floor($time/60)%60);
|
|
}
|
|
return $time_str;
|
|
}
|
|
function float_seconds_to_hhmmss_string(?float $time): ?string
|
|
{
|
|
$time_str = null;
|
|
if ($time !== null) {
|
|
$hours = floor($time / 3600);
|
|
$minutes = floor(($time % 3600) / 60);
|
|
$seconds = floor($time % 60);
|
|
$time_str = sprintf("%02d:%02d:%02d", $hours, $minutes, $seconds);
|
|
}
|
|
return $time_str;
|
|
}
|
|
function week_day_humanize(int $week_day,bool $upper = false) : string
|
|
{
|
|
$week_days = ["Lunes","Martes","Miércoles","Jueves","Viernes","Sábado","Domingo"];
|
|
$week_day_string = "";
|
|
if(in_array($week_day,range(0,6))){
|
|
$week_day_string = $week_days[$week_day];
|
|
}
|
|
if($upper){
|
|
$week_day_string = strtoupper($week_day_string);
|
|
}
|
|
return $week_day_string;
|
|
} |