Hire a senior Perl / Python programmer today; download my up-to-date resume (PDF)
John Bokma MexIT
freelance Perl programmer

Comments: Getting the date and time of digital photos


Since the number of photos I made with the Sony Cyber-Shot DSC-S600 I own is growing and growing I am looking for a way to organize it a bit better. I started with downloading pictures to a folder named after the year, month and day (i.e. yyyymmdd format). But when I ended up with several of such folders I had no idea which pictures were contained in which folder. So I decided to add a short description after the folder name, for example:

Read the rest of Getting the date and time of digital photos.


Way cool, some regular digital photo forensics. It works on my Canon PowerShot as well. I bet this is a pretty common encoding method on all digital photos.

Posted by Student Management Guy at 01:46 GMT on 20 August 2006

I have a Nikon D200 camera. The date is visible in the file, but the date starts at 0xb4. So yes, not all cameras store the date in the same place. Interesting idea though. I am going to try extracting the dates from my photos using php.

Posted by Nick at 01:42 GMT on 6 October 2006

Actually, the time/date in the files from my Nikon D200 begin at 0x180. That was a nice challenge. I now have a small php5 function that opens my Nikon D200 files and prints the date. Here it is:


function get_date_time() {
 // Open the file in Binary mode
 $fr = fopen('NJF.nef', 'rb');

 // Move pointer to 0x180 
 fseek($fr, 0x180);

 // Read the 19 bytes
 $date_time = fread($fr, 19);

 // Print the result
 print $date_time;


Example output:

2006:09:02 12:42:12
Posted by Nick Fessel at 02:32 GMT on 6 October 2006

Thanks Nick for sharing.

Posted by John Bokma at 16:06 GMT on 6 October 2006

Post a comment

Note that your comment doesn't show up immediately. I review each comment before I add it to this site.

Check the Follow this page option if you want to receive an email each time a comment is posted to this page, including yours. A link to turn this option off will be included with each email.

Internet adresses will be converted automatically. You can use the following notation to specify anchor text for a link: [url=http://example.com/]example text[/url].