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

  • Home
  • SEARCH
  • 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 6744093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:02:33+00:00 2026-05-26T12:02:33+00:00

Why: When I give input date string with GMT timezone, SimpleDateFormat parses it and

  • 0

Why: When I give input date string with GMT timezone, SimpleDateFormat parses it and outputs EET timezone?

public static String DATE_FORMAT="dd MMM yyyy hh:mm:ss z";
public static String CURRENT_DATE_STRING ="31 October 2011 11:19:56 GMT";
...
SimpleDateFormat simpleDateFormat =  new SimpleDateFormat(DATE_FORMAT, Locale.US);
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
System.out.println(simpleDateFormat.parseObject(CURRENT_DATE_STRING));

And the output is:

Mon Oct 31 13:19:56 EET 2011

rather than

Mon Oct 31 13:19:56 GMT 2011

  • 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-26T12:02:33+00:00Added an answer on May 26, 2026 at 12:02 pm

    You’re printing out the result of Date.toString(). A Date doesn’t have any concept of a timezone – it’s just the number of milliseconds since the UTC Unix epoch. Date.toString() always uses the system default time zone.

    Note that you shouldn’t be expecting “Mon Oct 31 13:19:56 GMT 2011” given that you’ve given a time which specifies a GMT hour of 11, not 13.

    If you want to use a specific time zone for printing, you should use another DateFormat for the printing, rather than using Date.toString(). (Date.toString() keeps causing confusion like this; it’s really unfortunate.)

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

Sidebar

Related Questions

i am using debugger following is my code when i give input for date
I donno to give the correct date format of the input date, so please
I want to give integer input to Ruby like this: 12 343 12312 12312
How can I give the input field below the characteristics listed below? Characteristics: -Text
What is a good way to give the input field below the three characteristics
pt=[2] pt[0]=raw_input() when i do this , and give an input suppose 1011 ,
I'm looking for a way to programmatically recreate the following effect: Give an input
I'm trying something like this Output.py print Hello Input.py greeting = raw_input(Give me the
hay all, I just did the following: a = input(give a word: ) b
I shall test a date string to see if it is one of these

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.