in reply to Re: How to get the File creation date
in thread How to get the File creation date

I done like this, but i get the answers is dome digit (i.e.) 198768745 how to convert this to date.
  • Comment on Re^2: How to get the File creation date

Replies are listed 'Best First'.
Re^3: How to get the File creation date
by Utilitarian (Vicar) on Aug 17, 2010 at 15:59 UTC
    What you have there is the number of seconds since midnight Jan 1 1970. This is known as epoch time. To convert you can use the localtime function, this returns, an array of the date elements by default, however if called in a scalar context it will return a time string, you can force scalar context with the scalar function ot by assigning to a scalar variable

    Alternatively read my sig ;)

    Incidental note, 198768745 represents Mon Apr 19 14:32:25 1976, so either

    • You typed in some random digits rather than the content of (stat $file)[9]
    • You're running a UnixTSS box
    • Or the figure came from somewhere else
    print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."