Skip to Content

Defalut time is displaying for SmartTable in the date column

Hello Experts and Rohit Chokhani

I am facing the issue with default time for Date column in SmartTable. please find the below screenshot for same.

Rohit Chokhani I found similar issue with you too, could you please share the solution/cod snippet so that I can try and check if the formatter works or not.

thank you in advance.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Feb 08, 2019 at 06:36 AM

    Hi Mahesh,

    Thank you for your valuable solution.

    After adding the below piece of code still issue was there. When I double check the EDM Core Type in OData I found that column assigned as

    Edm.DateTimeOffset. Since it is assigned I was getting default time in SmartTable date column, I changed EDM Core Type as Edm.DateTime.

      super->define().TRY.DATA(lo_entity_type)= model->get_entity_type( iv_entity_name ='Entity_Name').DATA(lo_property)= lo_entity_type->get_property( iv_property_name ='Date_Property_name').DATA(lo_annotation)= lo_property->/iwbep/if_mgw_odata_annotatabl~create_annotation('sap').
          lo_annotation->add( iv_key   ='display-format'
                              iv_value ='Date').CATCH/iwbep/cx_mgw_med_exception  .ENDTRY.ENDMETHOD.

    But the catch is, when download as excel along with date default time 00.00 was coming. after adding above code those default 00.00 time is fixed. Once again Thank you soo much Mahesh for your time.

    Regards, Kiran

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 23, 2019 at 08:05 AM

    Hi Kiran,

    You can use a formatter for the field.

    Use the below code and you should be able to solve your problem -

    <Text text="{path:'viewData>CreatedOn', type:'sap.ui.model.odata.type.DateTime', formatOptions: { pattern: 'MM-dd-yyyy'},constraints: {displayFormat: 'Date'}}"/>

    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.