Solved

Problems working with DateFormat

Posted on 2012-04-05
1
309 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jdbc error in jsp application 20 63
Running JavaFX on JDeveloper 12C 1 52
eclipse console opening separately 2 29
American Express @Work site and Java 4 18
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

808 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