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

Top Page

Reply to this message
Author: Sherwin Daganato
Date:  
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 #
70;72;69;6e;74;20;
27;4a;75;73;74;20;
61;6e;6f;74;68;65;
72;20;50;65;72;6c;
20;6e;6f;76;69;63;
65;27;:;;s=~?(..);
?=pack q$C$,hex$1;
;;;=egg;;;;eval;;;
_
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@???