If you have a JPG or HEIC photo on your computer, or in fact on any device or media other than on the actual device you took it on, then, before you use it, you should check that it contains EXIF metadata showing when the photo was taken and that it has a proper filename. If it does not, see if you can find a copy of the JPG or HEIC somewhere which does have EXIF metadata.
EXIF metadata, which is embedded as part of the data within the JPG/HEIC file, is distinct from file-system metadata which is maintained outside the file within the file-system directory. EXIF metadata includes the date/time that the photo was taken and also the Make and Model of the camera/phone, and other camera-specific fields such as the ISO speed rating, and focal length. File-system metadata, on the other hand, includes the date/time, filename, and size. If, when checking the metadata of a JPG or HEIC, you are in doubt as to whether the date/time you are looking at is the EXIF date/time or the file-system date/time, look to see whether the set of metadata you are looking at includes the Make and Model of the camera/phone, and other camera-specific fields such as the ISO speed rating, and focal length. If it does then the date/time you are looking at is the EXIF date/time. You can see this in the example above circled in red. The file-system date/time, on the other hand, is circled in blue in the above example.
In the example above, the EXIF date/time and file-system date/time are both showing 07/10/2023 10.27 and this is as you would expect immediately after a photo is taken, because the JPG/HEIC file is created only a few milliseconds after the picture is taken.
However if the JPG/HEIC file is subsequently copied to another device, then whilst the EXIF metadata, which is embedded as part of the data within the JPG/HEIC, will be unchanged, the file-system date/time of the new copy will reflect the date/time of the copy operation itself. If, instead of a "copy", you do a "move" operation the process involves (behind the scenes) copying the data to a new file on the new device and deleting the file on the old device, and on some systems the "move" operation is sophisticated enough to carry over the file-system date/time so that the file-system date/time set for the new file on the new device is the same as the file-system date/time of the old file. On some systems the file-system date/time actually consists of two fields: a date/time created and a date/time modified and it might be that after a "move" the file-system date/time created for the new file is set to the date /time of the "move" operation whereas the file-system date/time modified of the new file might be set to be the same as the file-system date/time modified of the old file. But the main point is that in general you can't rely on the file-system date/time as indicating when a photo was taken: you need to look at the EXIF date/time to be sure.
So if you have a JPG or HEIC photo which lacks EXIF metadata, see if you can find a copy of the JPG or HEIC somewhere which does have EXIF metadata.
The original phone (or SDcard) the photo was taken on is the best place to start looking for a JPG/HEIC with EXIF metadata, but the photo may have been taken some time ago on a mobile phone which has since been traded in for a new phone, or you might have lost the original digital camera or SDcard. And even if the original device is available, the original file might have been deleted from it to save space. So you might have look elsewhere for the best copy available - on other devices or on backup media.
Whenever you find another copy of the JPG/HEIC, check that it has full EXIF metadata showing when the photo was taken. Some methods of copying JPGs/HEICs cause all, or some specific items, of EXIF metadata to be lost, so do double-check that all EXIF metadata which should be present is present and look elsewhere for another copy if it is not.
Here are some possible reasons why a JPG or HEIC might not have full EXIF metadata showing when the photo was taken:-
The copy of the JPG/HEIC you have to hand might have been emailed to you by someone else, or you might have emailed it to yourself as a convenient way of copying it from one device to another. Copying some file types from one device to another by sending them by email can work satisfactorily but there is a potential trap for the unwary when using email to copy JPGs and HEICs because when you open an email containing a JPG/HEIC it might be displayed as an attachment or it might be displayed inline as part of the message. If it is displayed inline and you then save the inline picture the file as saved may not contain the EXIF metadata. It is usually possible to save inline images intact with EXIF metadata from an email when they are displayed inline but the method needed is not obvious and you might no longer have the email. If the JPG/HEIC was sent to you by someone you are still in contact with you could, particularly if it is an important photo, ask them if they can send you the photo within a ZIP file thus preserving EXIF metadata. If it is a photo you took, see if you can find a copy somewhere with intact EXIF metadata.
The copy of the JPG/HEIC you have to hand might have been sent to you by someone else using WhatsApp or some other similar messaging system. Such messaging systems typically remove EXIF metadata and reduce the number of pixels. If it was sent to you by someone you are still in contact with you could, particularly if it is an important photo, ask them if they can send you the photo within a ZIP file thus preserving EXIF metadata.
You might have moved the photo to a photo storage service in the cloud which, to save storage space, has stored it in "lossy" compressed form (by removing EXIF metadata and removing many pixels). See if you can find a copy somewhere with intact EXIF metadata.
The JPG photo might have been taken some ago using a phone which did not record EXIF metadata - most phones sold before 2010 did not record EXIF metadata on photos.
If it is a JPG satellite image or street view image supplied by Google, it will not have EXIF metadata because Google do not provide this. You can't get a copy with EXIF metadata from Google but what you can do is obtain a copy of the satellite image or street view image from Google marked with the year and month (street view) or at least the year (satellite images) that the image was taken. For how to do this see here and here.
The JPG might not be a digital photo at all but might have been created by scanning in a non-digital photo in card form, or by scanning in the negative on a specialist scanner. In this case EXIF there will usually be some limited EXIF metadata but this will just contain the make and model of the scanner, and not data about when the photo was taken.
The JPG might have been created by scanning a photo in card form but that card photo might originally have been printed from a digital photo. In this case there will usually be some limited EXIF metadata but it will be EXIF metadata from the scanning process, not the original EXIF metadata showing when the photo was taken. But there is the possibility that a JPG/HEIC with EXIF metadata showing when the photo was taken might exist somewhere. So it is worth checking.
Not all JPGs/HEICs which have EXIF metadata will include GPS data (it is an option which can be switched on or off on most phones) but if there is GPS data with a latitude of zero and a longitude of zero (and assuming it was not taken on a yacht in the Gulf of Guinea) that is usually an indication that the JPG/HEIC did have GPS data but that it has been stripped out during some copying process, so in this case you should look elsewhere for a copy with full EXIF metadata.
The information on this page about specific computer techniques is provided for information purposes only. Every reasonable effort has been made to ensure that the information is accurate and up to date at the time it was written but no responsibility for its accuracy, or for any consequences of relying on it, is assumed by me. You should satisfy yourself, before using any of the techniques, software or services described, that the techniques are appropriate for your purposes and that the software or service is reliable.