We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

show date of file created

XK8ER
XK8ER asked
on
Medium Priority
299 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
Comment
Watch Question

Commented:
in xp or vista?? you can show the details view is this what you are talking about??

Author

Commented:
this section is for PHP not windows i run on centos v5.2

Commented:
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.

Author

Commented:
once again.. this question is for PHP language not widows!
Sorry about him he must be new.  You can use filemtime

http://uk3.php.net/filemtime

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

Open in new window

Top Expert 2008

Commented:
>> 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
Yes I know what filectime does but that wouldn't give "Last Updated: Feb 8th - 3:25PM" would it now?  Thanks for trying though.
Top Expert 2008
Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Because the author didn't already know that????
Top Expert 2008

Commented:
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.
Top Expert 2008

Commented:
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.

Author

Commented:
no one answered my original question but you!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.