最近 XenApp 6.5 プラットフォームに移行したばかりのレガシー Java アプリケーションを維持しています。
しかし、現在の時刻を表示すると、Powered Shared Desktop のユーザーの時刻ではなく、サーバーの時刻が表示されます。
たとえば、ユーザーのタイムゾーン オフセットは 9.5 ですが、タイムゾーンを出力すると 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());
ユーザーの時間を取得する公式の方法はありますか?
また、VBS を使用して同じものを出力します。
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