- or download this
use POSIX 'strftime';
...
strftime $fmt, localtime(int $sec);
}
- or download this
# convert data2seconds, should be good until the year 2100
- or download this
use Time::Local 'timelocal_nocheck';
...
## add milliseconds on at the end:
$epoch .= ".$milli";
- or download this
$sec = "0" x (2 - length($time)).$time ;
$msec = "0" x (3 - length($msec)).$msec ;
- or download this
$sec = sprintf "%02d", $time;
$msec = sprintf "%03d", $msec;
- or download this
($format = $format ) =~ s/\%Y/$year/g ; # xxxx
($format = $format ) =~ s/\%m/$month/g ; # 1-12
($format = $format ) =~ s/\%d/$day/g ; # 01-31
- or download this
for ($format) {
s/%Y/$year/g;
s/%m/$month/g;
...
}
- or download this
my %data = (
Y => $year,
...
);
$format =~ s/\%([A-Za-z])/ exists $data{$1} ? $data{$1} : "%$1" /ge;