简体   繁体   中英

How to use tzutil to get all windows time zones into an array - java

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM