★ wanayoo — archive 1999 http://www.php.net/manual/ja/function.filemtime.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to ファイルシステム
Quick Reference
English version of this pageGerman version of this pageItalian version of this pageFrench version of this pageHungarian version of this page
ファイルシステム
* basename
* chgrp
* chmod
* chown
* clearstatcache
* copy
* delete
* dirname
* diskfreespace
* fclose
* feof
* fgetc
* fgetcsv
* fgets
* fgetss
* file
* file_exists
* fileatime
* filectime
* filegroup
* fileinode
* filemtime
* fileowner
* fileperms
* filesize
* filetype
* flock
* fopen
* fpassthru
* fputs
* fread
* fscanf
* fseek
* fstat
* ftell
* ftruncate
* fwrite
* set_file_buffer
* is_dir
* is_executable
* is_file
* is_link
* is_readable
* is_writeable
* link
* linkinfo
* mkdir
* pclose
* popen
* readfile
* readlink
* rename
* rewind
* rmdir
* stat
* lstat
* realpath
* symlink
* tempnam
* touch
* umask
* unlink
Manual: filemtime
View the source code for this pageSearch the site



Previous page
 fileinode
 Updated
Sat, 12 Aug 2000
fileowner 
Next page


filemtime

(PHP3 , PHP4 )

filemtime -- ファイルの更新時刻を取得する

説明

int filemtime (string filename)

ファイルの最終更新時刻を返し、エラーの場合はfalse を返します。時間はUNIXタイムスタンプとして返されます。

この関数の結果はキャッシュされます。詳細は、 clearstatcache()を参照下さい。

注意: この関数は、Windowsでは動作しません。


User Contributed Notes: filemtime


benbatten@home.com
29-Apr-1999 09:45
I was trying to figure out how to glean a simple "file last modified" time/date stamp while experimenting with PHP on Win95 (shudder) with PWS. filemtime() returned Unix epoch time in seconds. Here is a solution to get the 12 hour time and standard date format, for what its worth:

<PRE>

$filemod = filemtime(__FILE__);
$filemodtime = date("F j Y h:i:s A", $filemod);
Print("File last modified $filemodtime");

</PRE>

This will output the month, day of month, year and time (12 hour format) of the file's last modification.



gerardj@home.com
19-May-1999 08:27
The above code works fine if you place it on each page you want a date stamp on. I've found that if you place a reference such as <pre>filemtime(__FILE__)</pre> in an included or required file, that the modification time of the inherited file will be returned, not the time of the file that did the ineriting.


jay@fudge.org
29-Jun-1999 01:55
If you want this functionality for the parent web page you should use getlastmod()
i.e.
<pre>&lt;?php echo "Last modified: ".date( "F d Y H:i:s.", getlastmod() ); ?></pre>
within the included page... i.e. as a commont footer include for all pages



ian@eiloart.com
23-Jul-1999 08:56
See <a href=/old?u=http%3A%2F%2Fwww.php.net%2Fmanual%2Fja%2F%26quot%3Bhttp%3A%2Fwww.php.net%2Fmanual%2Ffunction.stat.php3%26quot%3B%26gt%3Bthis&y=1999 note</a> for the difference between filemtime and filectime.


chopin@csone.kaist.ac.kr
27-Aug-1999 02:36
It does not work when $filename is http url, you must read it from url header by socket open. see <a href=/old?u=http%3A%2F%2Fwww.php.net%2Fmanual%2Fja%2F%26quot%3Bhttp%3A%2Fwww.phpwizard.net%2FphpTidbits%2F%26quot%3B%26gt%3BphpTidbits-Socket&y=1999 operations</a>


chopin@csone.kaist.ac.kr
13-Sep-1999 12:19
SEE ALSO: touch()
Set File modification time





webmaster@info-loe.de
10-May-2000 05:48
How i can get the lastmodified date from an url like http://www.php.net/index.html


dursh@sutjav.com
15-Aug-2000 03:30
I can't seem to get filemtime to work for me when working with Mac files? I'm on a Win NT machine using PWS, and I need to get the dates from a CD with files created on a Mac. The dates view fine in Windows Explorer and DOS, but when trying the filemtime method with PHP, I keep getting "December 31, 1969, 7:00 pm"? Can somebody please tell me if there is a way to get the proper date from my Mac CDs?


 About Notes


Previous page
 fileinode
 Updated
Sat, 12 Aug 2000
fileowner 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.