How to parse a date? [duplicate]

You cannot expect to parse a date with a SimpleDateFormat that is set up with a different format. To parse your “Thu Jun 18 20:56:02 EDT 2009” date string you need a SimpleDateFormat like this (roughly): SimpleDateFormat parser=new SimpleDateFormat(“EEE MMM d HH:mm:ss zzz yyyy”); Use this to parse the string into a Date, and then … Read more