2

Somebody please help me in converting the time zone as said in the description. A little explanation on code will be great help in understanding the concept. Thanks in advance!

PS> Get-HotFix -id KB4537572 | select InstalledOn

InstalledOn
-----------
3/4/2020 12:00:00 AM


PS> $from = (Get-HotFix -id KB4537572 | select InstalledOn)

PS> $from

InstalledOn
-----------
3/4/2020 12:00:00 AM


PS> $to = 'Central Europe Standard Time'

PS> [System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId( $from , $to )
Cannot find an overload for "ConvertTimeBySystemTimeZoneId" and the argument count: "2".
At line:1 char:1
+ [System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId( $from , $to )
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest
mklement0
  • 382,024
  • 64
  • 607
  • 775
kaalel
  • 21
  • 2
  • 3
    In short: [`Select-Object`](https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/select-object) (`select`) returns _a `[pscustomobject]` instance_ that has the _requested properties_ - even when you're only asking for a _single_ property. To get only that property's _value_, use `-ExpandProperty ` instead - see the [linked answer](https://stackoverflow.com/a/48809321/45375) for details and alternatives. – mklement0 Mar 12 '20 at 17:47

0 Answers0