Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1399 → Rev 1402

/asterisk-stats/trunk/includes/functions.php
1,6 → 1,7
<?php
 
function FormatDuration($seconds) {
function FormatDuration($seconds)
{
$minutes = $seconds / 60;
$seconds = $seconds % 60;
$hours = $minutes / 60;
9,7 → 10,8
return sprintf("%d:%02d:%02d", $hours, $minutes, $seconds);
}
 
function FormatTime($time) {
function FormatTime($time)
{
//Format the time to human readable format
$diff = $time;
$hrsdiff = floor($diff/60/60);
21,10 → 23,21
return (' ('.$hrsdiff.'h '.$minsdiff.'m '.$secsdiff.'s)');
}
 
function FormatDateTime($date_str) {
function FormatDateTime($date_str)
{
$date_obj = date_create($date_str);
 
return date_format($date_obj, "D, j M Y G:i:s");
}
 
function SqlCanonEntryValue($field)
{
return "regexp_replace($field, '[^0-9]', '')";
}
 
function CanonEntryValue($value)
{
return preg_replace('/[^0-9]/', '', $value);
}
 
?>