on 03-17-2011 6:20 AM
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?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.