RE: [PHP] what is the format of the filemtime string
| From: | Philip Olson | Date: | Wed, 05 Jun 2002 20:27:14 +0000 |
| Subject: | RE: [PHP] what is the format of the filemtime string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-100785@lists.php.net to get a copy of this message | ||
Here's a quick HOWTO in figuring out how to
accomplish your goal.
First, after going here:
http://www.php.net/filemtime
You'll notice that filemtime() returns a unix
timestamp. And after going here:
http://www.php.net/date
You'll notice that date() takes on two
arguments/parameters with the second being an
optional timestamp. Optional parameters are
surrounded with [].
string date ( string format [, int timestamp])
This is where you'll use the timestamp that
filemtime() returned (into $last_mod). If
you left the optional timestamp parameter blank,
it will use the current time which would defeat
the purpose of your mission. The man page for
date() has many examples, here's another:
print date('Y m d, H:i:s', $last_mod);
Notice how $last_mod is a unix timestamp from
the filemtime() function so we passed that to
the appropriate date() parameter. As shown in
the manual, the first 'format' parameter is very
flexible with a ton of options. It's sort of
like a "create your own sundae" parameter :)
Unix timestamps are the number of seconds
since the Epoch, which is described here:
http://wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?EPOC
In short, do not fear the manual. It may seem
a little scary at first but it'll start to click
more and more for you. Good luck :)
Regards,
Philip Olson
On Wed, 5 Jun 2002, _michael wrote:
> tight i have tried what you said:
>
> $last_mod = filemtime($file);
> $tdate = date($last_mod);
>
> but now the output is in this format - c707-b076
>
> sorry to be ask again but can you give me more of a clue as you've probably
> guessed - i'm a novice
>
> thanks
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>