You could also introduce your own utility class in the Freemarker context and 
write a method which returns you a property as a Calendar.

[code]
    public Calendar metaDataAsCalendar(Node content, String property){
        try {
            if(content.hasNode(METADATA_NODE_NAME)){
                Node node = content.getNode(METADATA_NODE_NAME);
                Property metaDataProp = PropertyUtil.getProperty(node, 
property);
                if(metaDataProp != null){
                    return metaDataProp.getDate();
                }
            }
        } catch (RepositoryException e) {
            throw new RuntimeException(e);
        }
        return null;
    }
[/code]

I copied this from 
info.magnolia.module.templatingkit.functions.STKTemplatingFunctions#metaDataProperty
 and replaced the getString() by getDate()

After registering your custom utility class under 
/modules/rendering/renderers/freemarker/contextAttributes/ you could call 
${myfn.metaDataAsCalendar(content, "mgnl:lastModified")}

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=fd8a7fd1-fda7-4099-8d4a-b24989bcbd0f


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to