Search code examples
listviewsap-commerce-cloudcockpitbackoffice

How to change Date Format in listview in backoffice


I am trying to change date format in hybris backoffice listview and I wanted to display in dd/MM/yyyy format. Any help on this please.

Date format for Last Ship Date


Solution

  • After many trails I found the following solution. To change the date format in listview, we can do it in the following way.

    <context parent="GenericItem" type="AbstractOrder" component="listview">
      <list-view:list-view>
        <list-view:column qualifier="code" />
        <list-view:column qualifier="focusOrderNumber" />
        <list-view:column qualifier="date.getMonth()+1+'/'+date.getDate()+'/'+date.getYear()+1900)" label="type.AbstractOrder.date.name"/>
        <list-view:column qualifier="totalPrice" />
        <list-view:column qualifier="shipToUnit"/>
        <list-view:column qualifier="user" />
      </list-view:list-view>
    </context>
    

    Note: You can specify any delimiter in place of /.
    Note: The only problem with this approach is we can't add prefix 0 when date or month less than 10.

    It helped me. I hope it may help others too.