April 16, 2011, 10:22 p.m.
posted by stackme
Getting and Setting File Timestamps
The fileatime( ), filemtime( ), and filectime( ) functions return the time of last access, modification, and metadata change of a file, as shown in Figure.
Getting file timestamps
A file's modification time can be updated with touch( ). Without a second argument, touch( ) sets the modification time to the current date and time. To set a file's modification time to a specific value, pass that value as an epoch timestamp to touch( ) as a second argument. Figure changes the modification time of two files without changing their contents.
Changing file modification times
The fileatime( ) function returns the last time a file was opened for reading or writing. The filemtime( ) function returns the last time a file's contents were changed. The filectime( ) function returns the last time a file's contents or metadata (such as owner or permissions) were changed. Each function returns the time as an epoch timestamp.
The code in Figure prints the time a page on your web site was last updated.
Printing web page modification times