As someone pointed out the unexpected behavior really is coming from the parse method. Looking in the JavaDocs the behavior is likely coming from the DateFormat class:
By default, parsing is lenient: If the input is not in the form used by this object’s format method but can still be parsed as a date, then [...]
Archive for September, 2007
date puzzler explained
September 15, 2007a Java puzzler
September 14, 2007I’m a fan of Java Puzzlers and came across this one on my own. Perhaps it has been brought up before though. What happens when you run this program? Hopefully I can explain the answer by tomorrow!
public static void main(String[] args) {
SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd”);
try {
Date d = sdf.parse(“1957-02-29″);
System.out.println(“success: ” + d.toString());
} catch (ParseException [...]
summer photos
September 9, 2007Now that summer is winding down a bit, I thought I would go back through a few of my photos and link to them here.
Groovy and Google Notebook
September 8, 2007I started learning Groovy in the past few days. So far I am wondering why I waited so long to start learning it. I like the shorthand style and the ability to get tasks that are a pain in Java done quickly. These are obvious things to like certainly since they are objectives of the [...]
The Windows SDK
September 7, 2007I was reflecting recently on what it was like during my first few weeks as a professional software developer just out of college. My first job out of college was for a small consulting firm that specialized in writing custom Microsoft Windows programs in C. This was 16 bit Windows 3.1. One way that I [...]
