Is it possible to create a DateFormatter which converts a two-digit year into a four-digit year?
Posted
by
DR
on Stack Overflow
See other posts from Stack Overflow
or by DR
Published on 2011-02-28T15:12:41Z
Indexed on
2011/02/28
15:25 UTC
Read the original article
Hit count: 221
In my Java application I use a DateFormat
instance to parse date inputs.
DateFormat fmt;
fmt = DateFormat.getDateInstance(DateFormat.DEFAULT) // dd.MM.yyyy for de_DE
The problem is that the user insists to enter dates in the form 31.12.11
.
Unfortunately this is parsed to 31.12.11
. (0011-12-31
in ISO format) Instead I want the parsed date to become 31.12.2011
(2011-12-31
in ISO format).
Can I modify the date format to somehow parse inputs that way?
© Stack Overflow or respective owner