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

$.HDB with Date Type Column

Hello

I would like to use HDB Library to get data from SAP HANA.

var conn = $.hdb.getConnection();
  var rs = conn.executeQuery(query);
//
//
//
output.REPORT_HISTORY_ID = rs[i]["REPORT_BEGIN"];

I didn't get that Date as String but as UTC Date i think.

"REPORT_BEGIN": "2015-02-28T23:00:00.000Z",

I would like to get "REPORT_BEGIN":"01.03.2015"

When I use that $.db library with rs.getString() that works but I would like to use hdb.

Does anyone know how I get my output as String.

Thanks in advance

Houssem

table.PNG (2.5 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Aug 10, 2016 at 12:27 PM

    The $.HDB API returns the data as JavaScript types that match their corresponding database type. You don't have to specify the type with get or set functions. If you want to convert the date to a string just use normal JavaScript data functions to do so. JavaScript Date toString() Method JavaScript Date Reference

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Thomas Jung

      Done 😊

      Thanks

      function formatDate (input)
      {
      var d,m,y;
      d= input.getDate();
      if(Number(d)<10)
        d= '0'+d;
      m = input.getMonth();
      m= Number(m)+1;
      if(Number(m)<10)
        m= '0'+m;
      y= input.getFullYear();
      return (d+'.'+m+'.'+y);
      }
      

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.