cancel
Showing results for 
Search instead for 
Did you mean: 

DATE TRANSFROM function error

Former Member
0 Kudos

HI

i am getting value in yyyyMMdd format and i am changing it o yyyy-MM-dd

its working fine for valid dates../but when i get value as 00000000 in the idoc its returning some wierd num 0002-11-30

Why is it happening?

Accepted Solutions (1)

Accepted Solutions (1)

former_member189387
Active Contributor
0 Kudos

Hi ,

DateTrans will not handle blank or input date 00000000.

this is expected behavior. Some times it may produce the current date for the 000000000 string

Regards.,

V.Rangarajan.

Former Member
0 Kudos

Wat can be the alternative solution..coz when over thers no date in table for mandatory fields Idoc is gonna be stuffed with all zeros..

how to over come this

former_member189387
Active Contributor
0 Kudos

Hi ,

Check whether you can skip ( not populate ) that particular filed in the target idoc , if the source date is 00000000.

Then check if source value not 0000000 then use createIf node function .

Regards.,

V.Rangarajan

Answers (1)

Answers (1)

Former Member
0 Kudos

SimpleDateFormat is set to lenient date parsing by default, so it's trying it's best to come up with an actual date for 0000-00-00 (what would you say a 'zero' month should be?). You can prevent this "approximation" by using "setLenient(false)", but then you will get a null Date reference for non-parseable dates like the one you're using.

The bottom line is that you're going to have to do some validation for the user input and handle exceptional conditions.