strftime
Format a UNIX time value,
measured as the number of seconds since the Epoch (1970-01-01 00:00:00 UTC).
into a human-readable date and time string, according to the specified format.
The parameter is expected to be a date/time specification,
using the
POSIX strftime
tokens listed
here.
The default is "%a %b %d %H:%M:%S %Y".
Also see the convert_date filter.
Example
|
[filter strftime.%d.%B.%Y.%H:%M:%S.%Z]1171598662[/filter]
|
Results in:
|
16 February 2007 04:04:22 GMT
|
Source code
sub {
my $time = shift(@_);
shift(@_);
my $fmt = shift(@_);
while(my $add = shift(@_)) {
$fmt .= " $add";
}
if($fmt) {
return POSIX::strftime($fmt, localtime($time));
}
else {
return scalar localtime($time);
}
}
|