cancel
Showing results for 
Search instead for 
Did you mean: 

Change data format Edm.DateTime to show only date in ui5 list report

venu_001
Participant

Hi Experts,

I have developed UI5 report using list report template, all date fields shows date along with time but my requirement is to show only date.

I have already searched the blogs for the issue but i did not get helpful input to solve my issue. column property in odata sets to Edm.DateTime for all date fields, i noticed there is no Edm.Date format to set. All dates field shows with date and time, as it is only a standard format Edm.DateTime available for date fields in odata, I hope there could be a option in UI to hide time and show only date?

Below link talks about date format Edm.String and extensions, for my issue also to go for extensions?

https://answers.sap.com/questions/705464/date-format-in-fiori-elements-list-report-using-lo.html

Thanks,

Venu

nabheetscn
Active Contributor
0 Kudos

Are you using CDS views with annotations to generate the app or you have manually created it. For Fiori elements you can use date functions here to convert timestamp to Date. or if you have created your app manually then you should use a formatted, google it you will find N number of references.

venu_001
Participant
0 Kudos

Hi Nabheet,

I am not using CDS, extraction logic written in odata service and used list template for report with local annotations.

Thanks,

Venu

Accepted Solutions (1)

Accepted Solutions (1)

Pawan_Kesari
Active Contributor

Redefine DEFINE method in DPC_EXT class and try with following code

METHOD define.
  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.
venu_001
Participant
0 Kudos

Hi Pawan,

Thanks a lot for help, it solved my issue.

BR

Venu

Answers (1)

Answers (1)

jorge_cabanas
Participant

Hi,

I guess you should play with Date() object from JavaScript or just implement a method to manage your date.
If you provide any code block a better answer could be given 🙂

Kind regards,
Jorge.

venu_001
Participant
0 Kudos

Hi Jorge,

I am using list report(smart template) and odata service, where to write javascript?

Thanks

Venu