Modifying the metadata (EXIF and other tags) in an image file can be very complex. EXIF tags update and/or custom timestamp tags, or ....
Also, what to do if the tag does not exist. Re-write the whole file to add a tag; support roll-back if the re-write fails. And so on.
Suggested better choice for the end-user is to apply the EXIFTOOL utility.
https://exiftool.org/This is a phenomenal tool for photographers (others too) to manage image collections. Phil Harvey does an amazing job and also works hard to keep it up to date. Also there is quite useful GUI interface to the raw exiftool.exe and that is ExifToolGUI. ExifToolGUI probably handles 95% of typical users needs. Command line use of exiftool.exe can support batch operations and has the power to do just about anything. In addition to manipulating file metadata exiftool can manipulate file attributes, filenames, and file locations. It is great at creating a list of files with certain metadata values.