Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

localtime and stuff

by Anonymous Monk
on Jun 14, 2002 at 15:30 UTC ( #174569=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

foreach my $file (@userfiles) { my $size = format_size(-s "$user{site_id}/$file"); $mtime = (stat("$user{site_id}"))[9]; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = (localtime +($mtime)); $year += 1900; print qq~ <tr> <td bgcolor="#FFFFFF" align="center" width="25"> <input type="radio" name="select" value="file"> </td> <td bgcolor="#FFFFFF" align="center" width="175"> <font face="verdana" color="black" size="1"><a href="http://$user{'site_id'}/$file">$file</a> </td> <td bgcolor="#FFFFFF" align="center"> <font face="verdana" color="black" size="1"> $size</font> </td> <td bgcolor="#FFFFFF" align="center"> <font face="verdana" color="black" size="1">$mon-$mday-$year +</font> </td> </tr> ~; }
for some reason if I was to upload a dile to this direcotry, foreach file it would print the day that I upload it, not the original day foreach.

Replies are listed 'Best First'.
Re: localtime and stuff
by Abigail-II (Bishop) on Jun 14, 2002 at 15:39 UTC
    Well, if you upload the file, the file is modified (not on the system it came from, but certainly on the system it went to). And I guess that's the time you're getting.


      I see wat=ht I did wrong OI was stating the directory lol
Re: localtime and stuff
by marvell (Pilgrim) on Jun 14, 2002 at 15:34 UTC
    Sorry for missing the point, but what date would you like to be displayed?

    Steve Marvell

      when marvell asked "what date would you like" i believe he meant "what time relative to the lifespan of the file" not "read me the code you just posted".
      $mon-$mday-$year its displaying that.
        Sorry, I meant which date.

        Steve Marvell

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://174569]
Approved by grinder
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2018-06-20 00:34 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (116 votes). Check out past polls.