PHP ftp_mdtm() Function

Definition and Usage

The ftp_mdtm() function returns the last modified time of the specified file.

Syntax

ftp_login(ftp_connection,file)
Parameter Description
ftp_connection Required. Specifies the FTP connection to use (the identifier for the FTP connection).
file Required. Specifies the file to check.

Tips and Notes

Note:Not all FTP servers support this function.

Note:This function is not applicable for checking directories.

Example

<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
$mod = ftp_mdtm($conn,"test.txt");
//Return result in Unix timestamp
echo $mod;
echo "<br />";
//Format Unix timestamp to date
echo date(DATE_RFC822,$mod);
ftp_close($conn);
?>

Output:

1140082571
Thu, 16 Feb 2006 10:36:11 CET