[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

show date of file created

Posted on 2009-02-09
12
Medium Priority
?
291 Views
Last Modified: 2012-06-21
hello there,
how can I display the date of a file when it was created.. that way I can show something like this.

Last Updated: Feb 8th - 3:25PM
0
Comment
Question by:XK8ER
  • 4
  • 3
  • 3
  • +2
12 Comments
 
LVL 3

Expert Comment

by:ineedccs
ID: 23595866
in xp or vista?? you can show the details view is this what you are talking about??
0
 
LVL 1

Author Comment

by:XK8ER
ID: 23595906
this section is for PHP not windows i run on centos v5.2
0
 

Expert Comment

by:a1454
ID: 23595909
On any explorer window you have open, click View -> Detail

This should give you a column that shows the modified date of the file.

Just be careful though, if you have performed any type of recovery on your files, the date may not be correct.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:XK8ER
ID: 23595921
once again.. this question is for PHP language not widows!
0
 
LVL 8

Expert Comment

by:davesgonebananas
ID: 23596242
Sorry about him he must be new.  You can use filemtime

http://uk3.php.net/filemtime

$modified = filemtime("myfile.txt");

Open in new window

0
 
LVL 39

Expert Comment

by:Roger Baklund
ID: 23596671
>> the date of a file when it was created

filemtime() fetches the modified timestamp of the file, which seems to be what you really want, but you asked for the creation date. Beware that there is also a filectime() function. It will return the creation date of the file in some cases, but not all... on unix systems, it will return the timestamp of the directory entry (aka inode), which means it will change if the file is moved to a different folder or if file permissions or file ownership is changed.

http://php.net/manual/en/function.filectime.php
http://php.net/manual/en/function.filemtime.php
0
 
LVL 8

Expert Comment

by:davesgonebananas
ID: 23600181
Yes I know what filectime does but that wouldn't give "Last Updated: Feb 8th - 3:25PM" would it now?  Thanks for trying though.
0
 
LVL 39

Accepted Solution

by:
Roger Baklund earned 2000 total points
ID: 23600866
The functions filemtime() and filectime() will not output anything, they just fetch the timestamp from the file system. You can use date() to output the string you want:
echo 'Last updated: '.date('M jS - g:iA',filemtime($file));

Open in new window

0
 
LVL 8

Expert Comment

by:davesgonebananas
ID: 23600904
Because the author didn't already know that????
0
 
LVL 39

Expert Comment

by:Roger Baklund
ID: 23601823
davesgonebananas, you don't own this thread. Please allow the asker to respond to the input he is given. We don't know what he knows or not. Presumably he will accept the or those suggestions that was usefull for him.
0
 
LVL 39

Expert Comment

by:Roger Baklund
ID: 23607015
XK8ER, when multiple experts help you, you should split the points. In this case davesgonebananas suggested using filemtime() first, I only elaborated on that. It would be more fair if he got some of the points.
0
 
LVL 1

Author Comment

by:XK8ER
ID: 23607100
no one answered my original question but you!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month19 days, 1 hour left to enroll

834 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