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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:27:09+00:00 2026-05-24T22:27:09+00:00

I have totally strange problem on one of my machines. I’ve written a program

  • 0

I have totally strange problem on one of my machines. I’ve written a program which is monitoring events from our servers and displays them on a monitoring pc. However, each event status message also contains a TIMESTAMP which is being retrieved by the following calls:

Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
return sdf.format(cal.getTime());

with
public static final String DATE_FORMAT_NOW = “yyyy-MM-dd HH:mm:ss”;

I’m expecting this call to return the local time, which is and was working great until today. But now my program shows me the local time +3 hours on every incoming event. A restart of the jar file does not help at all and the System Time is also set up correctly. This program is running on a machine which is synchronizing its time with an central corporate clock.

Can anyone explain me the mentioned behavior and/or state a possible solution which is not “restart the machine and try again” 🙂 ?

Cliffs:
– Retrival of Time is working on my- or any other machine when I start the Program
– The target Machine is running 24/7 and is only a monitoring machine, so no one is changing any options there
– It worked fine until today.
– All Time/Timezone settings on the Hostsystem (Windows XP) are correct. (checked via CMD -> “date” and also over the System Preferences)

I appreciate any kind of answer to this issue. Thank you for your time!


the Question is answered since the 25 already. I’ve implemented a explicit call of Timezone.setDefault() to make sure that the proper timezone is being shown the whole time. I’ll close this Question now.

Thank you all for your answers!

  • 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-24T22:27:10+00:00Added an answer on May 24, 2026 at 10:27 pm

    This code:

    cal.getTime()
    

    Returns a Date object. A Date object is simply a wrapper for the UTC time as a long. In the code you showed us, it is just as correct to do sdf.format(new Date());

    What is the format DATE_FORMAT_NOW? I assume you specify this yourself. Do you specify the timezone in this format?

    EDIT As you mentioned in your comment, DATE_FORMAT_NOW does not specify a timezone. You should do both Timezone.getDefault() and sdf.getTimezone() to see if the value has changed to your locale + 3 hours.

    EDIT2 I found this forum post about the time sporadically changing. In this case it was caused by an Oracle driver calling Timezone.setDefault(...) in the middle of a method, then setting it back afterwards.

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

Sidebar

Related Questions

I have a strange kind of problem. I'm totally new to symfony2 so forgive
We have a very strange problem which we have yet to be able to
We have a strange issue with our C++ solution (which calls .NET 4.0 assemblies)
I have a server that is totally disconnected from the Internet (for some strange
Many applications have dialogs which have totally custom-looking dialogs, big fat tool-bars and non-rectangular
Totally confused by this one... We have a WAMPServer installation set up, running a
We have really strange and inconsistent behavior with Linq-to-SQL here. Our application is installed
I have a problem with strange character. In mysql this character cause error Incorrect
Let's say you have 2 totally separate projects: Project 1 and Project 2. One
Hi i have a strange problem with a WordPress plugin that i am writing,

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.