?
Solved

Problems working with DateFormat

Posted on 2012-04-05
1
Medium Priority
?
322 Views
Last Modified: 2012-04-05
Any idea why I am getting the following error:
java.text.ParseException: Unparseable date: "2011-09-21T22:30:00Z"

Here is the code snippet:
          String currentTime = "2011-09-21T22:30:00Z"
          DateFormat dfm = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
         
          try {
             long a = dfm.parse(currentTime).getTime();
          } catch (Exception e) {
             e.printStackTrace();
          }
0
Comment
Question by:dpalyca755
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
CPColin earned 2000 total points
ID: 37813887
Looks like it's the "Z" in the format string. If you put single quotes around that, like with the "T", it works.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question