Update check-time-zone.ps1 and list-timezone.ps1

This commit is contained in:
Markus Fleschutz 2022-10-15 10:42:44 +02:00
parent 742c44d8aa
commit e29b6db89a
2 changed files with 9 additions and 6 deletions

View File

@ -12,9 +12,11 @@
#> #>
try { try {
$TimeZone = (Get-Timezone) [system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US"
$Time = $((Get-Date).ToShortTimeString())
"✅ Time zone is $($TimeZone.DisplayName)." $TZ = (Get-Timezone)
if ($TZ.SupportsDaylightSavingTime) { $DST="+01DST" } else { $DST="" }
"$Time $($TZ.Id) (UTC+$($TZ.BaseUtcOffset) $DST)."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,6 +1,6 @@
<# <#
.SYNOPSIS .SYNOPSIS
Lists the details of the current time zone Lists time zone details
.DESCRIPTION .DESCRIPTION
This PowerShell script lists the details of the current time zone. This PowerShell script lists the details of the current time zone.
.EXAMPLE .EXAMPLE
@ -19,9 +19,10 @@
#> #>
try { try {
get-timezone [system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US"
Get-Timezone
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }