Skip to Content

OData working with dates and times

Hey guys,

i have a issue regarding handling dates and times with OData. I need to convert the data from odata to show it in the right format at the frontend. I worked through this post already:

Working with OData Dates and Times

I could get it worked with dates, but times are still not working.

The problem is somehow the conversion from OData to Javascript objects. The block says:

"Luckily if you use the ODataModel, datajs the OData library SAPUI5 uses has regular expressions and code logic which parses these values into JavaScript for us. Below is how this Entity looks parsed to JavaScript."


How is that working? Can someone please explain how I can see the Odata in JavaScript Objects?

Here is what I get when I call the Service? And there is also the problem. I have no ms in the time and therefore I cant convert it into a new date.

Thanks + regards

Chris

seins.png (18.7 kB)
meins.png (24.3 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jul 16, 2014 at 01:53 PM

    Hi Christoph,

    Suppose you are exposing this date in a define column table or textfield. You can manipulate the format by using pattern.


    Add a comment
    10|10000 characters needed characters exceeded

    • Thanks Carlos for your reply. Yes I know how to test the OData Model in the Browser, but I mean the following view. I cant get this view:

      And which parameter did I set in the oModel excactly to true -> new sap.ui.model.odata.ODataModel("/<name>/<name2>/<name3/name.xsodata/", true);


      I dont know how to determine this.

      (sServiceUrl, bJSON?, sUser?, sPassword?, mHeaders?, bTokenHandling?,bWithCredentials?, bLoadMetadataAsync?, annotationURI?,loadAnnotationsJoined?)

      seins.png (18.7 kB)

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.