[Originally posted by herm on 2008-03-12 19:52:52-07]Hi Forum users,
I am trying to set a xmp-dc:date tag to a PDF by calling
$exifTool->SetNewValue('XMP-dc:Date', "$DateChange");
If the variable $dateChange only contains a year ("1992") and not a full date ("1992:11:11") I get the following error:
"Invalid date/time (use YYYY:MM:DD HH:MM:SS[.SS][+/-HH:MM|Z]) in XMP-dc:Date (PrintConvInv)"
This is of course self-explanatory. But should you not be able to set only the Year in dc:date?
Is there a way to do this with exiftool?
Thanks in advance!
------------------
The Dublin Core Page says:
"Date may be used to express temporal information at any level of granularity. Recommended best practice is to use an encoding scheme, such as the W3CDTF profile of ISO 8601 [W3CDTF]." (
http://dublincore.org/documents/dces/)
And the W3CDTF referenced has 6 levels of dates:
"Year: YYYY (eg 1997)
Year and month: YYYY-MM (eg 1997-07)
Complete date: YYYY-MM-DD (eg 1997-07-16)
Complete date plus hours and minutes: YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
Complete date plus hours, minutes and seconds: YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
Complete date plus hours, minutes, seconds and a decimal fraction of a second YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)"
(
http://www.w3.org/TR/NOTE-datetime)
[Originally posted by exiftool on 2008-03-12 21:55:22-07]You are correct. The XMP specification allows various date/time
formats. To set the date to any non-standard (by exiftool standards)
value, use the
-n command-line option, or do this when
setting the value:
exifTool->SetNewValue('XMP-dc:Date', $DateChange, Type => 'ValueConv');
Also notice that I am consistently removing the double quotes from
around your variables, since they are not necessary if you just want
to pass the string value of a variable.
- Phil