Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Forums
Register
Login
Java
»
Beginning Java
Receiving ParseException with String containing ISO 8601 Formatted Date using Java 1.6
Andre Perezy
,
Greenhorn
Aug 27, 2014 18:45:59
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Keep getting a ParseException when I try to parse a ISO 8601 formatted
String
into a
Java
Date type.
String myDateString = "2014-07-04T22:59:36Z"; TimeZone timeZone = TimeZone.getTimeZone("UTC"); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'", Locale.US); dateFormat.setTimeZone(timeZone); Date formattedDate = dateFormat.parse(myDateString);
Keeps returning a ParseException:
Unparseable date: "2014-07-04T22:59:36Z"
What am I possibly doing wrong?
Avi Abrami
,
Ranch Hand
Aug 27, 2014 21:58:45
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Andre,
Your date string contains seconds.
Your format
pattern
does not.
Good Luck,
Avi.
Campbell Ritchie
,
Marshal
staff
Aug 28, 2014 03:40:38
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Welcome to the Ranch
Always tell us if you post
elsewhere
; you actually got the answer on the other forum first, so
you should
tell us that, too.
Post by:
autobot
I knew I would regret that burrito. But this tiny ad has never caused regrets:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
This thread has been viewed 582 times.
Similar Threads
Converting string to specific date format
A SimpleDateFormat for ISO 8601
String convert in to Date format
Oracle Date convert to java timestamp with new timezone
Handling a strange date format
More...
All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:41:50
.