SimpleDateFormat possible error in method parse

前端 未结 3 1644
死守一世寂寞
死守一世寂寞 2021-01-20 07:02

I receive a string that represent a date, I need convert this string to date, and validate that the string is a valid date.

I receive the string 33-12-2013 a the par

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-20 07:57

    The SimpleDateFormat class implements the Robustness Principle:

    Be conservative in what you do, be liberal in what you accept from others

    The implementors were probably aware of the behaviour of most Unix implementations of the POSIX mktime, which has similar behaviour.

    Whether that is wise is arguable.

提交回复
热议问题