There aren't thirteen months in a year. I suspect that your server is parsing date strings more strictly (it will reject that) whereas your local machine is allowing it as 31st Jan 2014. I know there's a property of Calendar instances that controls this, not sure if there's a default JVM setting too.
– Anthony GristOct 31 '13 at 15:01
@AnthonyGrist Well it makes sense, see http://stackoverflow.com/questions/7606387/what-is-the-use-of-lenient Do you have different locales configured on your local machine and your server?
– u6f6oOct 31 '13 at 15:12
@UlfGitschthaler I know what lenient does (notice my first comment saying that it's almost certainly caused by a difference in leniency between the two environments), I still don't see how `2013-13-31` becomes `2014-01-01` - that looks like 30 days are being lost. Plus I get `2014-01-31` as I'd expect when I run that code.
– Anthony GristOct 31 '13 at 15:18
1
I debugged this code on my local machine and I also get an IllegalArgumentException. In java.sql.Date#valueOf there is a check `if ((month >= 1 && month <= MAX_MONTH) && (day >= 1 && day <= MAX_DAY))` Since 13 > MAX_MONTH this check always evaluates to false. Do you use the same JDK versions on your local machine and your server?
– u6f6oNov 01 '13 at 09:58