How do I translate a timestamp in miliseconds to a time format like "13:52:11.12开发者_如何学Python"?
use DateTime;
my $t = time() * 1000 + 400;
print DateTime->from_epoch(epoch => $t/1000)->format_cldr('H:m:s.S');
# 13:22:47.4
divide by 1000 to get seconds.
Divide by 86400 to get days
Divide remainder of above division by 3600 to get hours
Divide remainder by 60 to get minutes, remainder is seconds
精彩评论