Skip to Content
0

mapping...

Jul 28, 2017 at 11:39 AM

52

avatar image
Former Member

Hi,

I am getting transaction time as

TransactionTime-2011-08-23 20:17:50.000 it want to split into two fields date and time how to acheive

1st field i achieved-using substring 0-10

2nd field i want to acheive 20:17:50 i am getting error if i use substring 12-23

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

2 Answers

Raghuraman S Jul 28, 2017 at 11:58 AM
0

If ter is a space between date and time field try the below UDF

For substring try with the below(11,11) since second parameter is number of characters not the end value.


capture3.png (15.0 kB)
capture1.png (41.0 kB)
capture.png (33.5 kB)
capture.png (73.8 kB)
Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Raghuram,

I tried this udf its working but want to trim .000 for time at the end.could you help

0

Try the below code Sai.

String[] splitted = var1[0].split("\\s+");
result.addValue(splitted[0]);
String[] out=splitted[1].split("\\.");
result1.addValue(out[0]);

0
Evgeniy Kolmakov Jul 28, 2017 at 04:27 PM
0

I would use replaceString function with source string as first parameter, date part from previous step as second and '' as third. I guess I'm too lazy :-)

Regards, Evgeniy.

Share
10 |10000 characters needed characters left characters exceeded