Sunday, March 4, 2012

Java Notes: Lenient


Class Hierarchy
 
java.lang.Object
  extended byjava.text.Format
      extended byjava.text.DateFormat

There is one method called : setLenient(boolean lenient)

setLenient() : is use to skip calculating date from undefined date but with correct format.

ex. 29/02/2001 doesn't throw an error but will change to 01/03/2001 if setLenient method to TRUE.
Remember there's no 29 february in 2001 years coz it is not a leap year (Syamsiah year).
But, if u don't wanna be like that, use setLenient method to FALSE

Sometimes, this small thing can trouble us if we implemented wrongly.

Just collecting notes and sharing..
Please let me know if there are wrong statements in this article or copy-paste one.

No comments:

Post a Comment