[ph-perl] Re: convert epoch seconds to a readable format (wa…

Top Page

Reply to this message
Author: Sherwin Daganato
To: plug
CC: ph-perl
Subject: [ph-perl] Re: convert epoch seconds to a readable format (was Re: [plug] to date format)
On Mon, Dec 16, 2002 at 02:44:47PM +0800, Sherwin Daganato wrote:
> (CC:ed ph-perl)
> On Mon, Dec 16, 2002 at 01:16:10AM -0500, Gerald Timothy Quimpo wrote:
> >
> > man shadow (on mandrake, not sure if you have that on your installation)
> > says that the last password change field is the number of days since
> > 1Jan1970 since the password was changed. so if it is "1", then
> > the password was last changed on 2 Jan 1970.
> it's called epoch seconds.

err! it _days_ since Jan 1 1970 not seconds. sorry.

> another solution (besides the one you posted earlier) is to use perl's
> locatime function.
> ex.
> $ perl -le 'print scalar localtime 1073867006'

should be
perl -le 'print scalar localtime 12429 * 60 * 60 * 24'

where 12429 is days since Jan 1 1970

$_=q:; # SHERWIN #
?=pack q$C$,hex$1;
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to plug-request@???

Fully Searchable Archives With Friendly Web Interface at http://marc.free.net.ph

To subscribe to the Linux Newbies' List: send "subscribe" in the body to ph-linux-newbie-request@???