如何使用tzutil将所有Windows时区转换为数组 - java

时间:2021-08-27 16:30:32

I'm using Microsoft tzutil command to change windows 7 time zone on my java application. tzutil has a command (tzutil /l) that displays the list of all available time zones(about 75). My application now hard coded all these time zones, I wonder if its possible to have a loop or something that iterate and insert these times zones from windows into a java array.

我正在使用Microsoft tzutil命令在我的java应用程序上更改Windows 7时区。 tzutil有一个命令(tzutil / l),显示所有可用时区的列表(大约75)。我的应用程序现在硬编码所有这些时区,我想知道它是否可能有一个循环或迭代的东西,并将这些时区从Windows插入到java数组中。

1 个解决方案

#1


0  

Just found this question via google.
Answering in case someone else wonders how to do this.
This Article provides nice info (:

刚刚通过谷歌发现了这个问题。回答以防其他人想知道如何做到这一点。这篇文章提供了很好的信息(:

Here's how to do the trick:

以下是如何做到这一点:

[System.Collections.ArrayList]$timeZones = [System.timezoneinfo]::GetSystemTimeZones() | Select-Object -ExpandProperty DisplayName
foreach($timeZone in $timeZones){
    Write-Host $timeZone
}

Rgds! Felix

#1


0  

Just found this question via google.
Answering in case someone else wonders how to do this.
This Article provides nice info (:

刚刚通过谷歌发现了这个问题。回答以防其他人想知道如何做到这一点。这篇文章提供了很好的信息(:

Here's how to do the trick:

以下是如何做到这一点:

[System.Collections.ArrayList]$timeZones = [System.timezoneinfo]::GetSystemTimeZones() | Select-Object -ExpandProperty DisplayName
foreach($timeZone in $timeZones){
    Write-Host $timeZone
}

Rgds! Felix