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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:56:25+00:00 2026-05-25T13:56:25+00:00

The following test fails: DateFormat df = new SimpleDateFormat(HH:mm:ss z); assertEquals(00:00:00 GMT, df.format(new Date(0)));

  • 0

The following test fails:

DateFormat df = new SimpleDateFormat("HH:mm:ss z");
assertEquals("00:00:00 GMT", df.format(new Date(0)));

expected “00:00:00 GMT” but was “01:00:00 GMT”

Could someone point out where I’m being stupid please?

I’ve spent longer looking at this than is would have taken me to just replace everything with Joda-Time. There’s a lesson there somewhere.

  • 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-25T13:56:25+00:00Added an answer on May 25, 2026 at 1:56 pm

    The problem is that Java has a bug around the name of the Europe/London time zone abbreviation in 1970.

    In the winter of 1970, the UK was still on UTC+1 – but Java believes it’s still called “GMT”. So what you’re seeing is the local time at midnight UTC on January 1st 1970… it’s just that we’re used to GMT=UTC, which is why it’s confusing.

    (As a side note, it would still be worth converting to Joda Time even now. Avoid the built-in libraries like the plague 🙂

    Joda Time prints the time zone abbreviation as “BST”. This seems equally bizarre given that it clearly wasn’t summer time… but it’s possible that the “S” here standards for Standard, as that was during the period of the “British Standard Time experiment”. See Wikipedia for details.

    (Note that UTC itself didn’t even exist at the Unix epoch – it was introduced in 1972. I’m assuming a proleptic UTC for the sake of this answer 🙂

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

Sidebar

Related Questions

I have the following test which seems to produce same strings but Assert.AreEqual fails.
I'm trying to test DataBinding within a WinForm application. The following test case fails.
I can't figure out why the following code fails: # test.ps1 `$args: ($args) `$args
The following test case passes in .NET 4.0: var fiT = new FileInfo(myhappyfilename); Assert.IsNotNull(fiT);
The following unit test fails, I make changes to an object that I've retrieved
Possible Duplicate: Java regex anomaly? any Idea why the following test fails (returns xx
Can anyone possibly tell me why the following test fails. var Person = function()
I have the following test: @Test(expected=ArithmeticException.class) public void divideByZero() { int n = 2
This startles me. The following test fails; the loop finishes with i having the
The event is not triggered when container.Release is called, the following test always fails:

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.