Hi there, I know Java Date Time is not a good way to go forward but I was just curious as to what's happening:
Why does the following line:
DateFormat df = new SimpleDateFormat("dd-MMM-yyyy", Locale.US)
not produce any errors and the following lines do:
DateFormat df = new SimpleDateFormat("DD-MMM-YYYY", Locale.US)
DateFormat df = new SimpleDateFormat("dd-mm-YYYY", Locale.US)
The following exception gets thrown:
Exception in thread "main" java.lang.IllegalArgumentException: Illegal pattern character 'Y'
at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:769)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:576)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:501)
at testing.MySchedule.main(MySchedule.java:18)
I mean I'm just changing the case right? but is DateFormat really that dumb or am I doing something wrong? or does it have something to do with the Locale I'm using?
Cheers