Skip to Content

Date format inKM

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Feb 09, 2005 at 08:56 AM

    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
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.