Skip to Content
0

How to convert varchar to datetime in SAP HCI Data Services

Jan 16 at 06:00 AM

228

avatar image
Former Member

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 .

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Kevin Teeling
Jan 17 at 12:09 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 18 at 01:19 PM
0

HI Kevin,

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

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

Share
10 |10000 characters needed characters left characters exceeded
Ashish Goel Jan 24 at 06:05 PM
0

Hi Abhilash,

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

to-date.jpg

Thanks,

Ashish


to-date.jpg (61.5 kB)
Share
10 |10000 characters needed characters left characters exceeded