-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_utils.php
More file actions
31 lines (22 loc) · 851 Bytes
/
Copy path_utils.php
File metadata and controls
31 lines (22 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
// The poorest reccomended security I ever saw. But let it be here.
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
// This file should contain util functions.
function simple_lineup__showbox_start_format($strDate){
// This format is what user visually percieve. - hh:mm d.m.Y
return DateTime::createFromFormat('Y-m-d H:i:s', $strDate)->format('G:i d.m.Y');
}
function simple_lineup__showbox_duration_format($minutes){
// This format is what user visually percieve. - DDd HHh MMm
$minutesToDisplay = $minutes % 60;
$hoursToDisplay = floor($minutes / 60);
$daysToDisplay = floor($minutes / 60 / 24);
$output = (string)$minutesToDisplay . 'm';
if($hoursToDisplay){
$output = (string)$hoursToDisplay . 'h ' . $output;
}
if($daysToDisplay){
$output = (string)$daysToDisplay . 'd ' . $output;
}
return $output;
}