Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Problems working with DateFormat

Posted on 2012-04-05
1
Medium Priority
?
327 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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…
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

604 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