Citrix XenApp 6.5下的Java当前日期/时间 [英] Current date/time in Java under Citrix Xenapp 6.5

查看:174
本文介绍了Citrix XenApp 6.5下的Java当前日期/时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们维护刚刚迁移到XenApp 6.5平台的传统Java应用程序。

We maintain a legacy Java application which has just recently migrated to the XenApp 6.5 platform.

但是当我们显示当前显示服务器时间的时间,而不是用户在动态共享桌面上的时间。

But when we display the current time it is displaying the server time and not the user's time on the Powered Shared Desktop.

例如,用户处于时区偏移9.5,但输出时区时显示为10。

For example, the user is in timezone offset 9.5, but when outputting the timezone it is displayed as 10.

我们尝试过:

TimeZone.getDefault().getID());
System.getProperty("user.timezone"));

我们正在获得时间:

private final static DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
private Calendar                intCal;


intCal = Calendar.getInstance();
intCal.setTimeInMillis(System.currentTimeMillis());
String df = dateFormat.format(intCal.getTime());

是否有正式的方式来获取用户的时间?

Is there an offical way to get the user's time?

还使用VBS输出相同的方式:

Also using a VBS it outputs the same:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colTimeZone = objWMIService.ExecQuery("Select * from Win32_TimeZone")

For Each objTimeZone in colTimeZone
    Wscript.Echo "Offset: "& objTimeZone.Bias / 60
Next


推荐答案

发现这是JRE本身中的一个bug,它在2011年被提出,最近在Java 9的早期版本中已经修复了:

I have found that this is a bug within the JRE itself and it was raised in 2011, it has recently been fixed in the early release of Java 9:

http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7044727

这篇关于Citrix XenApp 6.5下的Java当前日期/时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆