SimpleDateFormat and 2013-01-17T00: 00: 00-06: 00
What format will SimpleDateFormat use to parse incoming dates that look like this: "2013-01-17T00: 00: 00-06: 00"?
+3
Triton man
source
to share
5 answers
The format will look like yyyy-MM-dd'T'HH:mm:ssX
+1
Dan D.
source
to share
This format should work:
"yyyy-MM-dd'T'HH:mm:ssXXX"
+3
Henry
source
to share
You must strip the last colon to align it with the java zone information format "-0600"
.
Try the following:
String str = "2013-01-17T00:00:00-06:00";
new SimpleDataFormat("yyyy-MM-dd'T'hh:mm:ssZ").parse(str.replaceAll(":(..)$", "$1"));
+1
Bohemian
source
to share
YYYY-MM-dd'T'HH: mm: SSZ
Send this link: http://www.w3.org/TR/NOTE-datetime
0
c.pramod
source
to share
SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd'T'HH: mm: ssZ"); System.out.println (sdf.format (new GregorianCalendar (). GetTime ()));
This is not enough?
0
user991802
source
to share