cancel
Showing results for 
Search instead for 
Did you mean: 

Date Time Transforamtion error

santosh_k3
Active Participant
0 Kudos

Hi All,

I am getting an date time format as yyyy-MM-dd'T'HH:MM:SS for one of the input field.

I need to pass the this input to two output fields i..e, Date as 'yyyyMMdd' and Time as 'HHMMSS'

but the problem in the input datetime is coming as ex:- 2016-02-24T::

where hours,min,seconds are missing when this is missing we need pass default as 000000 ,in this case i need to pass date as 20160224 and time as default 000000


we tried using a DateTrans function and UDF as well but getting an error.

String outVal[]= new String[2];

String outDateTime=inDateTime.replace(":","");

outDateTime=inDateTime.replace("-","");

outVal=outDateTime.split("T");

return outVal[iIndex]; for date index is 0 and for time index is 1

Please help with sample code.

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Sai,

Will this work for you?

Regards,

Mark

santosh_k3
Active Participant
0 Kudos

Hi All,

Thanks for your inputs , It worked as mentioned by Mark

Answers (2)

Answers (2)

former_member213558
Active Participant
0 Kudos

place the logic as mentioned below.

maheswarareddykonda
Active Contributor
0 Kudos

HI,

i guess you can do this with out UDF,

if you get date as 2016-02-24T10:30:00

the length of the above format is 19 so if the length is less than 19 then use substring function to get only date(2016-02-24T) and paa to the target date field and other target field you can pass default value(000000)