Add check-time-zone.ps1

This commit is contained in:
Markus Fleschutz 2023-06-05 14:54:15 +02:00
parent 5e38219fe7
commit 91566b318b

View File

@ -16,10 +16,10 @@ try {
[system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US"
$Time = $((Get-Date).ToShortTimeString())
$TZ = (Get-Timezone)
if ($TZ.SupportsDaylightSavingTime) { $DST="+ 01:00:00 daylight saving time" } else { $DST="" }
Write-Host "$Time (UTC + $($TZ.BaseUtcOffset) $($TZ.Id) $DST)"
if ($TZ.SupportsDaylightSavingTime) { $DST=", DST+1h" } else { $DST="" }
Write-Host "$Time $($TZ.Id) time (TZ+$($TZ.BaseUtcOffset)$($DST))"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}
}