Hiermit wird das Datum der letzten Änderung der Daten zurückgegeben. Möchtest Du das Datum der letzten Änderung der Attribute haben, dann musst Du st_mtime in st_ctime ändern. Möchtest Du das Datum des letzten Zugriffs haben, dann musst Du st_mtime in st_atime ändern. Die Prozedur liefert als Ergebnis das Datum im Format JJJJMMTT.
PHP-Code:
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
long int RetrieveChangeTime(char *path) {
struct stat info;
struct tm date;
if (stat(path, &info) != 0)
return -1;
else {
localtime_r(&info.st_mtime, &date);
return (date.tm_mday) + ((date.tm_mon + 1) * 100) + ((date.tm_year + 1900) * 10000);
}
}
Bookmarks