getting an error saying
Caused by: java.time.DateTimeException: Conflict found: Field MonthOfYear 1 differs from MonthOfYear 3 derived from 2011-01-25
the code is working fine when i am replacing the string --"2011-03-25 21:22:22" with the string "2011-01-25 21:22:22"
it mean when i am changing month to 01 its working fine but when its more then 1 its giving me an error .
need to know why is it so and where i am going wrong ..
Thanks in advance
Replace "DD" with "dd" and you should be golden.
Rohit Gaikwad wrote:Thanks a lot Stephan I am one more question what is the difference in using YYYY or yyyy or uuuu as year string as even when i am changind yyyy to YYYY its giving me an Exception .
Rohit Gaikwad wrote:I am one more question what is the difference in using YYYY or yyyy or uuuu as year string as even when i am changind yyyy to YYYY its giving me an Exception .
All these letters are explained in the API documentation of the DateTimeFormatter class:
Regarding the week-based-year you'll probably find this explanation and this code snippet very usefulWithout line1 an exception is thrown at runtime.
Hope it helps!
December 26, 2 BC
December 26 of the year -1
Day 1 of week 1 of the year 0
The year-of-era ("y") is what you're most accustomed to: it starts at January 1, 1 AD. The day before that is December 31, 1 BC.
The proleptic year ("u") does the same for AD, except for BC it continues counting down: 0 for 1 BC, -1 for 2 BC, etc.
The week-based-year ("Y") works the same as the proleptic year, except it doesn't start counting years at the 1st of January, but at the first weekday of the first week of the year.
For example, if you start the week on Sunday (as the root locale does) then the week-based-year 2016 started on December 27, 2015.
Switching from electric heat to a rocket mass heater reduces your carbon footprint as much as parking 7 cars. Tiny ad:
The WEB SERVICES and JAX-RS Coursehttps://coderanch.com/t/690789/WEB-SERVICES-JAX-RS