Skip to Content
avatar image
Former Member

How to convert varchar to datetime in SAP HCI Data Services

Hi Experts,

My requirement is i need to convert varchar type to datetime type.

SAP->HCI->IBP

Example:
Input value : 01/05/2018 (MM/DD/YYY)
Output value required: 2018-01-05 00:00:00

please help on this .

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jan 17 at 12:09 PM

    Hi,

    For your desired output you could use a Groovy Script pallet to manipulate the String.

    Use the Java Date Class to help you.

    So, if your String is: "01/05/2018"

    And you want a String with: "2018-01-05 00:00:00"

    You could use the following Groovy Script:

    String oldDate = '04-05-2012'

    Date temporaryDate = Date.parse('dd-mm-yyyy', oldDate)

    String newDate = temporaryDate.format('yyyy-mm-dd hh:mm:ss')

    The String "newDate" will contain the desired formatted string.

    You may need to play around with this a bit, but this should guide you in the right direction.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 18 at 01:19 PM

    HI Kevin,

    i need to use the functions in SAP HCI data services.

    i think you have replied which supports by SAP HCI PO.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 24 at 06:05 PM

    Hi Abhilash,

    You can use to_date function under conversion tab of query transform.

    to-date.jpg

    Thanks,

    Ashish

    Add comment
    10|10000 characters needed characters exceeded