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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:20:09+00:00 2026-06-03T23:20:09+00:00

Our Java application uses TimeZone tz = TimeZone.getDefault() Are there any other methods of

  • 0

Our Java application uses

TimeZone tz = TimeZone.getDefault()

Are there any other methods of obtaining the machine’s time zone setting?

Background

Using TimeZone.getDefault() has worked very well for us for quite some time, in all the environments where our application runs: standalone Java application, inside Tomcat 5/6/7, on Windows XP, Windows 7 and Windows Server 2003/2008, 32 and 64-bit.

However, recently we have started running the application remotely via XenApp 6.5 on top of Windows 2008 R2. In this environment, the time zone our app sees is the server time zone, and not the time zone of the client, even though XenApp has been configured to perform “time zone redirection”. We are running on Java 1.6.0 update 30.

  • 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-03T23:20:10+00:00Added an answer on June 3, 2026 at 11:20 pm

    It appears this is a known problem with Java and Citrix XenApp. Even IBM’s Java based Lotus Notes client suffers from this problem. Unfortunately I could not find a solution anywhere.

    I was able to work around the problem by writing a very simple C# program that gets the time zone. This correctly reads the client’s time zone. I used the NodaTime library to read the time in tz database format, which is what Java uses to identify the time zones. Here is the program:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    using NodaTime;
    
    namespace WindowsTimeZoneReader
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine(DateTimeZone.GetSystemDefault() + "," + DateTime.Now);
            }
        }
    }
    

    From my Java program I execute this C# program using Runtime.exec() and the techniques described here to read this program’s output.

    Once I have this I can then simply compare the time zone reported by Java and that reported by my C# program:

    String windowsZone = ...; // The result of executing the above C# program
    String javaZone = TimeZone.getDefault().getID();
    if (!javaZone.equals(windowsZone)) {
      Java.setDefault( TimeZone.getTimeZone(windowsZone) );
    }
    

    All very convoluted, yes, but it appears to work.

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

Sidebar

Related Questions

Our project application uses Java 5 and now when I update Java 6, there
I'm using java 1.4.2 on Linux machine (RHEL 5.4). Our application uses log4j for
I've set up ehcache on our Java application, which uses Spring and Hibernate. However,
We use Tomcat for our java web application. There is a properties file under
In our legacy Java EE application, there are loads of value object (VO) classes
My application is mostly Java but, for certain calculations, uses a C++ library. Our
Currently our Java application uses the values held within a tab delimited *.cfg file.
Our application is a Java-GWT application that uses Guice-Persist and Guice-Servlet extensively. We have
my co-workers and I are reworking our application so that it uses java beans
Our Java application has a number of modules which implement a common interface. By

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.