8 Years
Discussion Span
Last Post by efecto

It can be as simple as this ...

import os
import time

# pick a file you have in the working directory
filename = "beachball.jpg"

# show file creation time
print( time.ctime(os.path.getctime(filename)) )

Keep in mind that vegaseat's solution will only show you when the photo was created in the filesystem. If you took the photo on a digital camera and then put it on your computer three days later, the creation date would not be the time the picture was taken.

A lot of cameras put information in the header of the jpeg file itself that might contain the date and time the photo was taken. I did a google search for "python jpeg metadata" and found a lot of results so you might be able to find a library to help you.

Votes + Comments
good info
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.