Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SimpleDateFormat provide wrong year

According to picture below, when I use item.takendate to SimpleDateFormat

I got "January 2016" instead of "January 2017"

what happen here? please advice.

enter image description here

Edit

However, when I use cdate parse back to Date it value is changed from 1st January to 2nd January

enter image description here

like image 932
Jongz Puangput Avatar asked Oct 16 '25 23:10

Jongz Puangput


1 Answers

When using SimpleDateFormat, YYYY and yyyy have different meanings! You almost certainly want to use yyyy (actual year) instead of YYYY (week year).

like image 114
Todd Avatar answered Oct 18 '25 16:10

Todd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!