JDBCSupport - An easy to use, light-weight JDBC framework -
Joined: Jun 04, 2008
Thanks for reply, Sebastian!
Is there any way to determine format of the date from the String? That would bring a generic solution, because i'm not sure what to submit to
new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z");
Imre Tokai wrote:Is there any way to determine format of the date from the String?
Well, sure. You look at it. It starts with "Wed", that's a day of the week. Then it carries on with "Apr", that's the name of a month. Then it has "21", which is almost certainly a day of the month, although it might possibly be a 2-digit year. Then it goes "16:02:00" which is clearly a time stamp, hours plus minutes plus seconds. Then it's got "CEST" which is the name of a time zone. Sort of. And finally it has "2010" which must be the year. That removes the possibility that the "21" earlier was a 2-digit year.
But if you were hoping to write code which implements that sort of intelligence, it isn't going to be easy. In fact I would try to change the requirements rather than being forced into doing that. Instead, control the requirements so that you say what format the date string should be in.