When I use the following command:
$arrDIR[$filename] = filemtime($filename);
It will return "1302021664" for all the $filename
s in the array 开发者_如何学Python$arrDIR
. Is this suppose to be some kind of date or something?
Yes. That's the UNIX timestamp for Tue Apr 05 17:41:04 2011. filemtime
gives you a UNIX timestamp.
It's the Unix Timestamp (i.e. the number of seconds since the Epoch, 1/1/1970). You can convert it to human-readable time using the date( )
function (see http://www.php.net/manual/en/function.date.php).
So if you wanted it in a UK date-format, you would do:
$arrDIR[$filename] = date( 'H:i:s d/m/Y', filemtime($filename) );
which would set $arrDIR[$filename] = "16:41:04 05/04/2011"
This is unix time stamp you have to convert it into date
$time= filemtime($filename);
echo date('Y-m-d',$time);
see http://docs.php.net/filemtime:
Returns the time the file was last modified, or FALSE on failure. The time is returned as a Unix timestamp, which is suitable for the date() function.
It's a unix timestamp. It shows the seconds from the Unix epoch. See here for more data : http://www.unixtimestamp.com/index.php
You can use php's date()
method to format it : http://php.net/manual/en/function.date.php
This function returns the time when the data blocks of a file were being written to, that is, the time when the content of the file was changed. Returns the time the file was last modified, or FALSE on failure. The time is returned as a Unix timestamp, which is suitable for the date() function.
So, it returns the time as a Unix timestamp of when it was last modified.
Manual
Yes, it is. Its a unix timestamp. See filemtime() for further information and also date() on how you can format it.
精彩评论