John's Corner

Get embedded dates from files

This tip covers how to extract create and modify dates from files programmatically.

The time and date information associated with files such as creation date or last modified date, are generally captured in two ways. One way is to use the file system to capture it. All file systems do this, so it is a reliable way to get time and date information, but the time and date returned might not always be what they seem. This is particularly true for the create date. It will only be true for the file system on which the file was originally created. Any file copied to another file system will return the date it was created on that file system.

Another way is to store this information within the file, so that is always with the file, no matter where is is copied to. Time and dates stored within the file will carry across to any subsequent copies on other file systems.

Not all files have the ability to store time/date information within the file. Legacy DOS and Windows files did not have this but the capability was added by Microsoft and third parties to some file types as native Win32 systems became dominant.

The commands below are for Unix/Linux based systems for the file types indicated:

GIF, JPG, PNG Files

 

PDF Files


Return to Tips and Tricks

John's Corner