Your input string date is not correct. According to Date Pattern, the
letter 'h' means : Hour in am/pm (1-12)
It accepts only 1-12 and not '0' like you did.

http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

Here is an example which is working :
https://www.dropbox.com/s/34rtr0fwq04boy4/Screenshot%202014-08-29%2017.59.42.png?dl=0


On Fri, Aug 29, 2014 at 4:30 PM, sandp <sandeepred...@gmail.com> wrote:

> camel-bindy is throwing an *java.text.ParseException * on failing to parse
> date with format *"dd-MMM-yyyy hh"*
>
>
> *The date field in the CsvRecord is:*
>         @DataField(pos = 1, required = true, pattern = "dd-MMM-yyyy hh")
>
>
> *Row from CSV file:*
> "10-Nov-2013 00","ARTHUR","2","CON ED NY CITY",332.8,90,90,,35,,70,,0,23512
>
>
> *Sample test below works fine:*
> private static void testDate(){
>                 String dateString="10-Nov-2013 00";
>                 SimpleDateFormat dateFormat = new
> SimpleDateFormat("dd-MMM-yyyy hh");
>                 Date date =null;
>                 try {
>                          date = dateFormat.parse(dateString);
>                 } catch (ParseException e) {
>                         // TODO Auto-generated catch block
>                         e.printStackTrace();
>                 }
>                   System.out.println( " Formated date :" +      date);
>         }
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/camel-bindy-2-13-1-DateFormat-Unparseable-date-tp5755843.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

Reply via email to