-
Notifications
You must be signed in to change notification settings - Fork 0
/
Show-Selected-TimeZones.ps1
45 lines (41 loc) · 1.33 KB
/
Show-Selected-TimeZones.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<#
.SYNOPSIS
Show Selected Time Zones.
.DESCRIPTION
Show current time:
.\Show-Selected-TimeZones.ps1
Show Custom time or date and time:
.\Show-Selected-TimeZones.ps1 -Time '20:30:12'
.\Show-Selected-TimeZones.ps1 -Time '12.05.2012 20:30:12'
.NOTES
Central Europe Standard Time is assumed to be default machine configuration.
If no time but the date is specified, the default time will be 00:00:00.
Show all Available Time Zones:
Get-TimeZone -ListAvailable | select -Property ID,BaseUtcOffset
.LINK
https://github.com/adrianbiro/winbin
#>
Param(
[Parameter(Mandatory = $false)]
[datetime]$Time = (Get-Date)
)
[string[]]$Zones = @(
'Pacific Standard Time',
'Mountain Standard Time',
'Central Standard Time',
'Eastern Standard Time',
'Greenwich Standard Time',
'Central Europe Standard Time',
'Israel Standard Time',
'Central Asia Standard Time',
'Singapore Standard Time',
'Tokyo Standard Time'
)
$Obj = @()
foreach ($i in $Zones) {
$Obj += New-Object psobject -Property @{
DateTime = [System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId($Time, $i)
TimeZone = $i
}
}
$Obj | Sort-Object -Property "DateTime" | Select-Object -Property "TimeZone", "DateTime"