cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert varchar to datetime in SAP HCI Data Services

Former Member
0 Kudos

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 .

Accepted Solutions (0)

Answers (3)

Answers (3)

ashish_goel4
Active Participant
0 Kudos

Hi Abhilash,

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

to-date.jpg

Thanks,

Ashish

Former Member
0 Kudos

HI Kevin,

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

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

0 Kudos

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.