in reply to Converting GPS seconds to readable time&date
gmtime in scalar context should do the trick:
printsperl -e 'print scalar( gmtime( 915725119 ) ),"\n"'
Thu Jan 7 16:05:19 1999
Update:There's a lot of talk about which CPAN date module to use but for whatever reason, I always fall back on Date::Manip. With that module, you have tons of control over lots of most aspects of time:
(there's probably tons of ways to simplify that). Or if you just need a pretty string, you could always use strftime:perl -MDate::Manip -e 'print UnixDate( ParseDate(scalar(gmtime(9157251 +19))), "%m/%d/%Y %i:%M:%S %p"), "\n"'
(format strings to strftime tend to be platform dependent)#!/usr/bin/perl use POSIX qw( strftime ); print strftime( "%m/%d/%Y %l:%M:%S %p", gmtime( 915725119 ) ), "\n";
|
|---|