Links --

What a funny name you have...

...and then LinkS On WeB said...
% 
% using the stat function, say I was using $stat[9],
% which displays the time of the file, how would I make
% it just display the date. Month-DayofMonth-Year

Take the seconds that come out of stat and feed them to localtime and
interpret from there (months are 0 - 11; years are years since 1900):

  [zero] [4:27pm] ~>  touch 01020304 fooble

  [zero] [4:27pm] ~>  ls -lF fooble
  -rw-r--r--   1 davidtg         0 Wed Jan 02 03:04:00 2002 fooble 

  [zero] [4:27pm] ~>  perl -e '$mtime = (stat("./fooble"))[9]; \
    (undef,$min,$hour,$day,$mon,$year) = (localtime($mtime)); \
    print "Year is $year, Mon is $mon, Day is $day, \
    Hour is $hour, Min is $min\n";'
  Year is 102, Mon is 0, Day is 2, Hour is 3, Min is 4

See

  perldoc -f stat
  perldoc -f localtime

and have fun :-)


HTH & HAND

:-D
-- 
David T-G                      * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: msg05380/pgp00000.pgp
Description: PGP signature

Reply via email to