I have a program which reads a Dateformat from user once and for all at the beginning of program such as yyyy/MM/dd HH:mm:ss a
Later on the program parses a File and use the Dateformat for all dates in the file. But recently I got a file, where 99% of the dates were 2014/09/01 12:00:04 AM
So The user can input yyyy/MM/dd HH:mm:ss a
.
However one date in that file is simply 2014/09/01
where the date format yyyy/MM/dd HH:mm:ss a
fails.
Why can't yyyy/MM/dd HH:mm:ss a
format shorter dates such as in the format yyyy/MM/dd
.
What I want is that the java program use the format yyyy/MM/dd HH:mm:ss a
to parse the following two dates below:
- 2014/09/01 12:00:04 AM
- 2014/09/01
Thanks