开发者

I'm using filemtime and it keeps returning the following numbers: 1302021664. Why is this?

When I use the following command:

$arrDIR[$filename] = filemtime($filename);

It will return "1302021664" for all the $filenames 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜