Export from Mac Photos app while keeping date created data?

The accepted answer assumes one knows how to use the command line. If you do not, here are the assumed precursor steps:

1) Install a package manager, if you don’t have one installed already. (And then use it forever to install new software :))

(Recommended:)

For Mac: use Homebrew – https://brew.sh/

For Windows: use Chocolatey – https://chocolatey.org/

2) Using your (^^ newly installed) package manager, install exiftool, which is free software for viewing/working with media metadata:

On Mac:

brew install exiftool

On Windows:

choco install exiftool

3) Navigate to the directory containing your image/movie files by using the ‘change directory’ command: cd – (Read more about how to use the command line here: https://www.digitalcitizen.life/command-prompt-how-use-basic-commands)

cd {insert-name-of-your-file-directory-here}

4) The last command is based on the above accepted answer(s), but I found that I needed to switch this to CreationDate for it to actually reflect the original photos’/videos’ capture date. And I also opted for using touch:

One-liner version (copy and paste this):

for file in *; do touch -t "$(exiftool -p '$CreationDate' -d '%Y%m%d%H%M' "$file")" "$file"; done

(Same code, but formatted for readability in case you want to understand what is happening):

for file in *; do   
    touch -t "$(exiftool -p '$CreationDate' -d '%Y%m%d%H%M' "$file")" "$file";   
done