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 8489103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:43:59+00:00 2026-06-10T21:43:59+00:00

I want to transform this data: Thu, 06 Sep 2012 16:15:00 +0200 in the

  • 0

I want to transform this data: “Thu, 06 Sep 2012 16:15:00 +0200” in the format yyyy-MM-dd HH:mm

this is my code:

private static final SimpleDateFormat rssFormat = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z");
public static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = rssFormat.parse(pubDate);
date.setHours(date.getHours()+2); //this is for gmt difference
this.pubDate = dateFormat.format(date);

it seems ok…why does it throw this exception?

java.text.ParseException: Unparseable date: "Tue, 04 Sep 2012 16:45:00 +0200"
  • 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-06-10T21:44:01+00:00Added an answer on June 10, 2026 at 9:44 pm

    Works for me – but then, I’m in a locale where “Thu” is a valid day abbreviation, and “Sep” is a valid month abbreviation. Perhaps you aren’t? Assuming you know you will be getting US-English day/month names, you should specify that. Try this:

    new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z", Locale.US);
    

    Note that you absolutely should not be calling Date.setHours and Date.getHours like this. Those methods have both been deprecated for over 15 years.

    Instead, you should be formatting with a SimpleDateFormat set into an appropriate time zone… or preferrably, you should use Joda Time in the first place, which is a much more pleasant date/time API.

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

Sidebar

Related Questions

I've got this data: 73636333759.90 73637286413.70 73637286413.70 I want to transform it to this:
I have this. I want to click and transfer the clicked data to another
This is my Xml file.i want to transform this xml file into another customized
Given the following sequence: normal %(b)BOLD% normal I want to transform this into the
I have this Javascript data: [{id:123,type:test},{id:154,type:another}] How would you transform that into something so
I have this piece of code that runs a function to transform a color
I have a JavaScript app that produces a string. I want to transfer this
I want this url http://www.youtube.com/watch?v=dgNgODPIO0w&feature=rec-HM-fresh+div to be transformed to: http://www.youtube.com/v/dgNgODPIO0w with php.
I have a project in Java. I want transform it to .NET-project. How to
I want to transform the dataset list, where the row is composed of different

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.