Skip to Content
author's profile photo Former Member
Former Member

Issue with HANA Date Format

Hi,

I am trying Develope UI5 application using SAP HANA Extended Application Services. I am facing an issue with date format. As of now i am using json odata model for connection. i have created one XMl View through which user can Upload a . CSV File and after uploading it

Data is Inserting in the Hana DB Table Using Odata.But Iam Facing a issue with Date Format. in CSV Date Fornat is MM/DD/YYYY . But it is not accepting in HANADB. it is only accepting this Value " "/Date(-210866803200000)/" not that Data Format

here is the screenshot

Thanks and Regards,

Shardul Pandey

Capture.PNG (21.1 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jul 15, 2016 at 01:33 PM

    Discussion successfully moved from SAP HANA Cloud Platform Developer Center to SAP HANA Developer Center

    as the more appropriate community for this topic.

    Regards, Mike (Moderator)

    SAP Technology RIG

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 15, 2016 at 06:11 PM

    Hi Shardul,

    I don't really understand your question. If you need to change your time format before updating it to the data base , you can use something like this:

    var currentDate1 = new Date(parseInt(dateString)); var displayDate = currentDate1.toISOString().substring(0,10); var year = displayDate.substring(0,4); var month = displayDate.substring(5,7); var date = displayDate.substring(8,10);

    Best Regards,

    Saumil Sharma

    Add a comment
    10|10000 characters needed characters exceeded

    • As I wrote above. Create a JS Date object, get the milliseconds since 1970 with method getTime and create the required string (consider you only have to do this in case you are not dealing with standard UI5 controls which implements that behavior already).

      For instance you can create a helper function like that:

      function convDateToODataFormat(sDate){
          return '/Date(' + new Date(sDate).getTime() + ')/';
      }
      

      When you call it like

      convDateToODataFormat('2016/2/02')
      

      it returns the result '/Date(1454367600000)/'.

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.