forked from science-ation/science-ation
Make format_date, format_time and format_datetime accept either a unix timestamp, or a text string
switch important_dates to use format_datetime
This commit is contained in:
parent
c45edf34ec
commit
b2fb7855f0
@ -1107,18 +1107,32 @@ function theme_icon($icon) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//$d can be a unix timestamp integer, OR a text string, eg 2008-01-22
|
||||||
function format_date($d) {
|
function format_date($d) {
|
||||||
global $config;
|
global $config;
|
||||||
return date($config['dateformat'],strtotime($d));
|
if(is_numeric($d))
|
||||||
|
return date($config['dateformat'],$d);
|
||||||
|
else
|
||||||
|
return date($config['dateformat'],strtotime($d));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//$t can be a unix timestamp integer, or a text string, eg 10:23:48
|
||||||
function format_time($t) {
|
function format_time($t) {
|
||||||
global $config;
|
global $config;
|
||||||
return date($config['timeformat'],strtotime($t));
|
if(is_numeric($t))
|
||||||
|
return date($config['timeformat'],$t);
|
||||||
|
else
|
||||||
|
return date($config['timeformat'],strtotime($t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//$dt can be a unix timestamp integer, or a text string, eg 2008-01-22 10:23:48
|
||||||
function format_datetime($dt) {
|
function format_datetime($dt) {
|
||||||
list($d,$t)=split(" ",$dt);
|
if(is_numeric($dt)) {
|
||||||
return format_date($d)." ".i18n("at")." ".format_time($t);
|
return format_date($dt)." ".i18n("at")." ".format_time($dt);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
list($d,$t)=split(" ",$dt);
|
||||||
|
return format_date($d)." ".i18n("at")." ".format_time($t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
if($r->date == '0000-00-00 00:00:00')
|
if($r->date == '0000-00-00 00:00:00')
|
||||||
$d = i18n("not specified");
|
$d = i18n("not specified");
|
||||||
else
|
else
|
||||||
$d = date($config['dateformat']." ".$config['timeformat'],$r->udate);
|
$d = format_datetime($r->udate);
|
||||||
echo "<tr class=\"$trclass\"><td>".i18n($r->description)."</td><td>$d</td></tr>";
|
echo "<tr class=\"$trclass\"><td>".i18n($r->description)."</td><td>$d</td></tr>";
|
||||||
}
|
}
|
||||||
echo "</table>";
|
echo "</table>";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user