Skip to content

Commit a31fcc2

Browse files
author
Markus Fleschutz
committed
Update check-time-zone.ps1
1 parent c056e4e commit a31fcc2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Scripts/check-time-zone.ps1

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
This PowerShell script queries the time zone and prints it.
66
.EXAMPLE
77
PS> ./check-time-zone
8-
✅ 11:13 AM (UTC + 01:00:00 W. Europe Standard Time + 01:00:00 daylight saving time)
8+
✅ 11:13 AM W. Europe Summer Time (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna (+01:00 DST)
99
.LINK
1010
https://github.com/fleschutz/PowerShell
1111
.NOTES
@@ -16,8 +16,14 @@ try {
1616
[system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US"
1717
$Time = $((Get-Date).ToShortTimeString())
1818
$TZ = (Get-Timezone)
19-
if ($TZ.SupportsDaylightSavingTime) { $DST=", DST+1h" } else { $DST="" }
20-
Write-Host "$Time @ $($TZ.Id) (TZ+$($TZ.BaseUtcOffset)$($DST))"
19+
if ($TZ.SupportsDaylightSavingTime) {
20+
$TZName = $TZ.DaylightName
21+
$DST=" (+01:00 DST)"
22+
} else {
23+
$TZName = $TZ.StandardName
24+
$DST=""
25+
}
26+
Write-Host "$Time $TZName $($TZ.DisplayName)$($DST)"
2127
exit 0 # success
2228
} catch {
2329
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

0 commit comments

Comments
 (0)