Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1402 → Rev 1399

/asterisk-stats/trunk/includes/functions.php
1,7 → 1,6
<?php
 
function FormatDuration($seconds)
{
function FormatDuration($seconds) {
$minutes = $seconds / 60;
$seconds = $seconds % 60;
$hours = $minutes / 60;
10,8 → 9,7
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);
23,21 → 21,10
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);
}
 
?>