Reputation: 841
So I am using this class "SimpleDateFormat" so that I can convert number of days in a year to a date, using "DDD". However, I'm not sure if this covers leap years because I don't see an option where I can specify that this year is a leap. If I specify a year, will it already know that it is a leap? I just want to be sure.
Thank You, ejay
Upvotes: 0
Views: 2813
Reputation: 1257
The SimpleDateFormat works well with Leap years in Julian calendar :)
Just in case.... you can set the lenient attribute to false.
SimpleDateFormat sf=new SimpleDateFormat("ddMMMyyyy");
sf.setLenient(false);
sf.parse("29Feb2012");//OK
sf.parse("29Feb2003");//throws parseException
Upvotes: 3