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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:54:14+00:00 2026-06-08T12:54:14+00:00

The following Java test passes on our US hosted build server. It also passes

  • 0

The following Java test passes on our US hosted build server. It also passes on non-US servers, e.g. in Germany. It fails on my local server, which is running in Ireland. The following code illustrates a failing test.

org.junit.ComparisonFailure: expected:<[4/6/09 11:30 AM]> but was:<[06/04/09 11:30]>

Is there a system setting I can provide to get these tests passing locally?

public void testFormattedDate() {
// Set the default time zone in case this unit test is executed in a different country
TimeZone.setDefault(TimeZone.getTimeZone(DateUtil.DEFAULT_TIMEZONE));
final Date utilDate = new Date();
utilDate.setDate(6);
utilDate.setHours(11);
utilDate.setMinutes(30);
utilDate.setMonth(3);
utilDate.setSeconds(45);
utilDate.setYear(109);

SimpleDateFormat dateFormatter = new SimpleDateFormat();        
final String formattedOutput = dateFormatter.format(utilDate);

Assert.assertEquals("4/6/09 11:30 AM", formattedOutput);
}  
  • 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-08T12:54:16+00:00Added an answer on June 8, 2026 at 12:54 pm

    Have to tried to provide a pattern to the SimpleDateFormat ?

    SimpleDateFormat dateFormatter = new SimpleDateFormat("d/M/yy HH:mm a");

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

Sidebar

Related Questions

When trying to run a junit test I get the following error - java.lang.ClassCastException:
I tried the following code: import java.math.BigInteger; import org.apache.commons.codec.binary.Base32; import org.junit.Test; public class Sandbox
Suppose I have the following Java file in a library: package test; public abstract
I have the following Java code: import java.util.Arrays; import java.util.Collections; public class Test {
I have a thttpd server set-up which has the following html file. When I
I have the following java code: public class CheckInnerStatic { private static class Test
In C# I have the following attribute above a method: [Test, SetCulture(en-GB)] which, I
Given the following Java which is loaded into the database using loadjava: package grassie.example;
Given the following Java code: public class Test { static private class MyThread extends
I am trying the following code on Java: String test = http://asda.aasd.sd.google.com/asdasdawrqwfqwfqwfqwf; String regex

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.