@Test
    public void testDates() throws Exception{

        SimpleDateFormat ISO8601DATEFORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
        String dateReceived = "2014-06-18T06:22:17+00:00";
        StringBuilder sb = new StringBuilder("2014-06-18T06:22:17+00:00");
        if(dateReceived.length()==25)
        {
           sb.deleteCharAt(22);
            Date newDate = ISO8601DATEFORMAT.parse(sb.toString());
            StringBuilder sb1 = new StringBuilder(ISO8601DATEFORMAT.format(newDate));
            sb1.insert(22,':');
        }
//        String parsed = dateReceived.replaceAll("\\+0([0-9]){1}\\:00", "+0$100");
//
//        Date newDate = ISO8601DATEFORMAT.parse(parsed);
//        System.out.println(newDate);
//
//        System.out.println(ISO8601DATEFORMAT.format(newDate));
//
        SimpleDateFormat ISO8601= new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");

        Date anotherDate = ISO8601.parse("2014-05-09T13:39:00");

        System.out.println(anotherDate);
        System.out.println(ISO8601DATEFORMAT.format(anotherDate));
       }