Date Uploaded to Server?

He has: 1,380 posts

Joined: Feb 2002

Hey....

Basically what I'm doing is opening a dir, displaying all contents, and I want to display a "Posted on: (date)" next to it. I'm using PHP.

I checked php.net, and found nothing of use...but I know in the FTP programs it tells you file size, and date modified...

Any ideas?

Thanks.

He has: 1,380 posts

Joined: Feb 2002

Nevermind! I found it!

<?php
getmtime
($file);
?>

It returns a date string, formattable by date(), and returns FALSE if there is no data

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Usually for comments the time is included in the file when the comment is made, or in a database. You may find that the getmtime() function doesn't return the right time for the document depending on where the function is called (and if the document is included in another or contains includes). Just FYI. Wink

He has: 1,380 posts

Joined: Feb 2002

It doesnt' really matter all that much....I just want to give people an idea of what order they were posted in. Its for videos and songs in zip files...and new ones come on all the time, so to just make it simple...that's good enough. No databases necessary.

Busy's picture

He has: 6,151 posts

Joined: May 2001

Just remember PHP time works off the server time, so if your not near your server (location) it could be out by an hour or two.

My host for example is 17 hours out from my local time.

He has: 1,380 posts

Joined: Feb 2002

I originally just needed the date...but check out my other thread cuz I changed my mind

http://webmaster-forums.net/showthread.php?t=26487

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.