Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7597971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:17:31+00:00 2026-05-30T22:17:31+00:00

I have the following Java: DateFormat formatter = new SimpleDateFormat( EEE MMM dd yyyy

  • 0

I have the following Java:

DateFormat formatter = new SimpleDateFormat(
    "EEE MMM dd yyyy HH:mm:ss zZ (zzzz)", Locale.ENGLISH);
Calendar cal = Calendar.getInstance();
cal.set(2011, Calendar.APRIL, 1);
out.println(formatter.format(cal.getTime()));
out.println();

Date date;
try {
    date = formatter
        .parse("Fri Apr 01 2011 00:00:00 GMT-0400 (Eastern Daylight Time)");
} catch (ParseException e) {
    out.println("Failed to parse date: " + e.getMessage());
    e.printStackTrace(out);
}

This is in a servlet, and the Calendar-constructed date comes out as:

Fri Apr 01 2011 16:42:24 EDT-0400 (Eastern Daylight Time)

This looks like the same format as the date string I’m trying to parse, except for EDT-0400 versus the desired GMT-0400. The code fails when trying to parse the date string:

java.text.ParseException: Unparseable date: “Fri Apr 01 2011 00:00:00 GMT-0400 (Eastern Daylight Time)”

How can I parse such a string? This is coming from a JavaScript date in a Sencha Touch 1.1.1 model, stored in WebSQL local storage.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:17:32+00:00Added an answer on May 30, 2026 at 10:17 pm

    For some reason GMT-0400 isnt’ working, and UTC-0400 is working. You can replace GMT with UTC.

    Note that this part will be completely ignored – the timezone will be resolved from what’s found in the brackets (at least on my machine, JDK 6)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Java code: final Future future = exeService.submit( new Runnable() {
If I have the following Java code: int[][] readAPuzzle() { Scanner input = new
I have the following snippet of java code: File directoryToMoveTo = new File(file.getParent()+_TEMP); boolean
I have the following Java code: byte[] signatureBytes = getSignature(); String signatureString = new
Say I have the following java code: Object myObj = new ArrayList(); List myList
I have the following java code: UrlValidator urlValidator = new UrlValidator(); boolean validUrl =
I have the following Java 6 code: Query q = em.createNativeQuery( select T.* +
I have the following java class with the JAXB @XMLRootElement annotation @XmlRootElement(name=ClientData) public class
Say suppose I have the following Java code. public class Example { public static
I have the following simple Java code: package testj; import java.util.*; public class Query<T>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.