What is the correct form for parse this date?: 2015-05-29T00:00:00+02:00
DateFormat format = new SimpleDateFormat("yyyyy-mm-dd hh:mm:ss");
Date data = format.parse(dataValue);
Advertisement
Answer
Try with
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
Notice that
MMrepresents months, whilemmrepresents minutes.- if you want to have 24h format use
HH,hhis for 12h format XXXrepresents time zone in format like-08:00- to add literal like
Tin format you need to surround it with single quotes'like'T'