Jeremy, I can't see that jb's code does much different than yours. I think the real problem is a basic Perl issue that you have missed: "-M $file" (or, apparently, "$file->{'mtime'}", with which I have no experience) returns the timestamp of $file as a difference between the actual timestamp and the start time of the perl session.
Therefore, most files that existed before you started your script will have negative values for "-M $file". Knowing that the Unix and Perl clocks start in 1970, it would seem that "69" is probably a result of a negative number being passed to localtime, which is consistent with the way "-M $file" works. You might want to add in $^T before converting to a text date. Note that even the Perl 5 Pocket Reference documents this. However, perhaps the documentation for "$file->{'mtime'}" is not clear, I've not looked at it. [EMAIL PROTECTED] wrote: > Jeremy, > > While we are willing to help, your questions are more appropriate for the > Perl-Win32-Users mailing list. The Perl-Win32-GUI mailing list is > specifically for the Win32::GUI module. You can sign up for the > Perl-Win32-Users mailing list using the following link: > http://mailarchive.activestate.com > > Someone posted the following code for handling dates and I've found it very > useful. > > sub get_date { > # Define arrays for the day of the week and month of the year. > @days = > ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); > @months = > ('January','February','March','April','May','June','July','August','Septembe > r','October','November','December'); > # Get the current time and format the hour, minutes and seconds. Add > # 1900 to the year to get the full 4 digit year. > ($sec,$min,$hour,$mday,$mon,$year,$wday) = > (localtime(time))[0,1,2,3,4,5,6]; > $time = sprintf("%02d:%02d:%02d",$hour,$min,$sec); > $year += 1900; > # Format the date. > $date = "$days[$wday], $months[$mon] $mday, $year at $time"; > } > > jb > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of > Jeremy Aiyadurai > Sent: Wednesday, April 04, 2001 12:57 AM > To: perl-win32-gui-users@lists.sourceforge.net > Subject: [perl-win32-gui-users] localtime($file->{'mtime'}) problem > > hi > > i am having a problem getting proper modified time dates of files when > using the win32:Internet ftp list, or the standard directory listing > > i do this > ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = > localtime($file->{'mtime'}); > > then for each file i do something like this > > print "$year/$mon/$mday $file->{'name'}); > > for every file, i end up getting a modified date of 69/11/31 thefile > > eg; > > 69 - 11 - 31 bbsetup.exe 144152 bytes > 69 - 11 - 31 clients.pl 29 bytes > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Perl-Win32-GUI-Users@lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Perl-Win32-GUI-Users@lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > _________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Perl-Win32-GUI-Users@lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users -- Glenn ===== Even if you're on the right track, you'll get run over if you just sit there. -- Will Rogers