In our company, KM will be used by Europe, China and US. Hence, date format should be for example, "24 Nov, 2004" instead of 11/24/2004 (MM/DD/YYYY). Is it possible to chnage the property"modified" to show the above format. Atleast, I would like to describe the date in the column heading in the layout. Can this be done?
Thanks,
Viji
Hi Viji,
unfortunately not in the current release. But you can easily add a new cutom property renderer for Date types. An implementation could look like this:
public class DatePropertyRenderer implements IModelledPropertyRenderer {
public Component renderProperty(IProperty prop, IMetaName metaname, IResource resource, IProxy proxy, IParameters p) throws WcmException {
if (resource==null) return null;
if (prop==null) return null;
IProperty dateProp = Property.createLastModifiedProp(new Date());
IPropertyName dateName = dateProp.getPropertyName();
IPropertyName cdateName = prop.getPropertyName();
if (dateName.getNamespace().equalsIgnoreCase(cdateName.getNamespace()) &&
(dateName.getName().equalsIgnoreCase(cdateName.getName()))
) {
Date date =prop.getDateValue();
if (date!=null) {
TextView desc = new TextView();
desc.setWrapping(true);
SimpleDateFormat f = new SimpleDateFormat("dd.MM.yyyy");
desc.setText(f.format(date));
f = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
desc.setTooltip(f.format(date));
return desc;
}
}
return null;
}
}
Register the implementation in the Property Metadata Service and assign it to the modified property.
Regards,
Thilo
Add a comment