Solved

Problems working with DateFormat

Posted on 2012-04-05
1
308 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
1 Comment
 
LVL 14

Accepted Solution

by:
CPColin earned 500 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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
eclipse java  build path 6 59
print map entry 34 69
by zero exception 10 41
jsp login check 12 32
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

803 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