Coercing string to date
i using following bit of code extract xmp createdate photoshop image.
var md = thumb.metadata;
md.namespace = "http://ns.adobe.com/xap/1.0/";
minfo = md.createdate + "\n" + md.authorsposition;
unfortunately, returns string "2008-01-13t00:52:18-6:00"
how coerce specific date format i.e.: "01/13/2008, 1:52:18 pm"
can in initial query, or there built in method converting returned value?
- james
there few ways of doing it, 1 of more simpler methods use string manipulation, example...
var thumb = app.document.selections[0]; var md = thumb.synchronousmetadata; md.namespace = "http://ns.adobe.com/xap/1.0/"; var d = md.createdate; var db = d.match(/\d+/g); var dateis = db[1]+"/"+db[2]+"/"+db[0]+", "+db[3]+":"+db[4]+":"+db[5]+" "; var amorpm = "am"; if (number(db[3]) > 11) amorpm = "pm"; dateis += amorpm; alert (dateis );
More discussions in Bridge General Discussion
adobe
Comments
Post a Comment