Solved

Easiest way to show date a file was created on.

Posted on 1998-08-04
12
184 Views
Last Modified: 2010-03-05
Hi,
     What is the easist way to show the date a file was created on?

Thanks in Advance.
0
Comment
Question by:cide
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3
12 Comments
 

Author Comment

by:cide
ID: 1209010
Edited text of question
0
 
LVL 5

Accepted Solution

by:
b2pi earned 10 total points
ID: 1209011
You can't get the date a file was created on, just the date that it was last saved on.  This, however, will give you the number of days since the file was modified

($^T-(stat $filename)[9])/(60*60*24)

Then, you can use DateCalc in Date::Manip to convert that into a readable date.

0
 
LVL 84

Expert Comment

by:ozo
ID: 1209012
Number of days since it was last modified would be
 -M $filename
a readable date would be
 scalar localtime((stat $filename)[9])
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Expert Comment

by:b2pi
ID: 1209013
ozo, are you sure that -M works on win32?  I had thought that there might be bugs with it...
0
 
LVL 84

Expert Comment

by:ozo
ID: 1209014
It seems to work the same as ($^T-(stat $filename)[9])/(60*60*24)
What version are you using?
0
 

Author Comment

by:cide
ID: 1209015
Then you do you use Date::Manip?
0
 
LVL 84

Expert Comment

by:ozo
ID: 1209016
What do you want to do with Date::Manip?
0
 
LVL 5

Expert Comment

by:b2pi
ID: 1209017
perldoc Date::manip

Look at UnixDate

0
 

Author Comment

by:cide
ID: 1209018
I want to show dd/mm/yy.
0
 
LVL 84

Expert Comment

by:ozo
ID: 1209019
($d,$m,$y) = (localtime((stat $filename)[9]))[3,4,5];
$m+=1; $y+=1900;
printf("%02d/%02d/%d\n",$d,$m,$y);

use Date::Manip;
print &UnixDate(scalar localtime((stat $filename)[9]),"%d/%m/%Y");
0
 
LVL 84

Expert Comment

by:ozo
ID: 1209020
use POSIX;
print strftime"%d/%m/%Y",localtime((stat $filename)[9]);
0
 

Author Comment

by:cide
ID: 1209021
Thank you would you like the points ozo?
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question