Display current time with time zone in PowerShell

前端 未结 7 927
盖世英雄少女心
盖世英雄少女心 2021-02-14 02:06

I\'m trying to display the local time on my system with the TimeZone. How can I display time in this format the simplest way possible on any system?:

Time: 8:00:34 AM ES

7条回答
  •  没有蜡笔的小新
    2021-02-14 02:50

    You should look into DateTime format strings. Although I'm not sure they can return a time zone short name, you can easily get an offset from UTC.

    $formatteddate = "{0:h:mm:ss tt zzz}" -f (get-date)
    

    This returns:

    8:00:34 AM -04:00
    

提交回复
热议问题