Main Menu

DateTime Formats

Started by Archive, May 12, 2010, 08:53:58 AM

Previous topic - Next topic

Archive

[Originally posted by jeffee on 2006-12-20 06:17:41-08]

I have just started looking into using ExifTool.  It seems very useful so far; however it did took me some time to understand how to use it.

I was wondering if there has been any discussion or thought on using the DateTime and DateTime::Format::ISO8601 to handle the date fields from XMP:EXIF data ?

I have a number of files that have XMP:EXIF data added by Photoshop Elements 3 & 4 (I think).  The format is of the form: '2006-11-01T03:00-05:00'.  This seems ok according to ISO 8601.  There are a number of other possibilities defined in the spec. as well.

The XMP.pm subroutine FoundXMP() converts the XMP date to an EXIF formatted date.  The problem is that it only recognizes XMP dates of a format like this: '2006-11-01T03:00:00...',  where ... is non-whitespace characters.

Any thoughts on using the DateTime module to track date/time fields ?

Archive

[Originally posted by exiftool on 2006-12-20 12:36:35-08]

DateTime::Format::ISO8601  doesn't handle standard EXIF date/time format, which is:

Code:
   YYYY:MM:DD HH:MM:SS

And this is the external format to which ExifTool converts all date/times.

If you want to display them differently, ExifTool offers an option to do that.

- Phil

Archive

[Originally posted by jeffee on 2006-12-21 03:47:21-08]

Hi, Phil.  Thanks for the response

I wasn't clear but I was thinking that the DateTime::Format::XX classes in general would add the ability to parse and format dates more easily and completely.  For instance, I could read a date using the DateTime::Format::ISO8601 class and then write it in a custom format (from DateTime) or from another class, such as DateTime::Format::MySQL.

I'm not sure how something like this would integrate with the existing codebase.  I mainly was thinking of getting more complete parsing of the 8601 standard, since in my case the XPM.pm file fails to parse the time written by Adobe Photoshop Elements.  As it turns out, after some testing tonight, the DateTime::Format::ISO8601 class rejects the format I previously mentioned (19981227T03:00-05:00, ie. no seconds).  That may have been an oversight, I don't know.

For now, a simple extra elsif at XPM.pm:1649 like:
Code:
} elsif ($val =~ /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}:\d{2})(\S*)$/) {
    $val = "$1:$2:$3 $4:00$5";     # convert back to EXIF time format

will get me moving forward...

Thanks,
Jeff

Archive

[Originally posted by exiftool on 2006-12-21 12:30:48-08]

Hi Jeff,

Sorry.  I missed your point that the date/time was missing the seconds.
I have checked the XMP specification, and this is a legal format.  I will
add the ability to parse this to the next release of ExifTool.

Thanks for pointing this out.

- Phil

Archive

[Originally posted by jeffee on 2006-12-23 04:47:52-08]

Great.  Thanks.

-Jeff