Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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.

Comment on localtime and stuff
Download Code
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2015-11-26 06:17 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (696 votes), past polls