Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

filemtime

Description

The filemtime of Filesystem for PHP gets file modification time.

Syntax

filemtime(
    string $filename
): int|false

Parameters

filename

Path to the file.

Return

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.

Examples

1 · filename

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';

$return = filemtime($filename);

echo $return;

?>
1728861341

2 · date

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';

$return = filemtime($filename);

echo "last modified: " . date("Y-m-d H:i:s", $return);

?>
last modified: 2024-10-13 23:15:41
HomeMenu