I have created a custom asset bassed on the file asset. It contains an attribute that has a date which I use the datetime type for.
I have got it all working on the details and asset creation pages with the selection boxes and js chooser, however I need to use these assets in a asset listing. The date attribute needs to be referenced as 'Month dd, yyy' or dd m yyy.
At the present it gives a '2006-09-19 --:–:--'
I have tried to work out how to translate the date into other formats but am getting lost.
Can I ask why you're doing this with a custom asset instead of using a metadata schema to store the date value?
Because the asset will be created with an asset builder from the front-end and automitically listed.
As far as I can tell you cant apply metadata schema and values through the front-end using the asset-builder.
Please let me know if I am mistaken.
Nope, you're correct.
I was just curious.
In order to display the date as you want, you'll need to create a keyword for it. I'll let one of the developers explain how the keyword replacement functions work.
You're correct about the asset builder not being able to expose metadata field interfaces on the create screen. If you definitely need the extra field on the create screen then adding an attribute is probably the correct way to go.
For datetime atttribute keywords like %asset_attribute_birthday% you can use a set of suffixes like %asset_attribute_attribute_readabledate%. These are all listed in core/include/general.inc I think, or you can just look at the suffixes available for the core date fields like "updated" and "created" which are the same.
If none of those suffixes do what you want, you could define a function in your asset called getAssetAttributeBirthdayKeywordReplacement() which reads the attribute value using $this->attr and returns it formatted the way you want.
Bingo!
Thanks that worked perfectly.