Skip to content

Commit 6fdcf8d

Browse files
author
Markus Fleschutz
committed
Update check-time-zone.ps1
1 parent 0317564 commit 6fdcf8d

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

scripts/check-time-zone.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
.SYNOPSIS
33
Checks the time zone
44
.DESCRIPTION
5-
This PowerShell script queries the time zone and prints it.
5+
This PowerShell script queries the local time zone and prints it.
66
.EXAMPLE
77
PS> ./check-time-zone.ps1
8-
11:13 AM W. Europe Summer Time (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna (+01:00 DST)
8+
3:27 PM in W. Europe Summer Time (UTC+01:00:00 +1h DST)
99
.LINK
1010
https://github.com/fleschutz/PowerShell
1111
.NOTES
@@ -16,14 +16,15 @@ try {
1616
[system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US"
1717
$Time = $((Get-Date).ToShortTimeString())
1818
$TZ = (Get-Timezone)
19+
$offset = $TZ.BaseUtcOffset
1920
if ($TZ.SupportsDaylightSavingTime) {
2021
$TZName = $TZ.DaylightName
21-
$DST=" (+01:00 DST)"
22+
$DST=" +1h DST"
2223
} else {
2324
$TZName = $TZ.StandardName
2425
$DST=""
2526
}
26-
Write-Host "$Time $TZName $($TZ.DisplayName)$($DST)"
27+
Write-Host "$Time in $TZName (UTC+$($offset)$($DST))"
2728
exit 0 # success
2829
} catch {
2930
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

0 commit comments

Comments
 (0)