我目前有
$GAIBC = Get-Item "C:\Users\nosho\Documents\Paradox Interactive\Stellaris\mod\gaibc\common\districts\02_rural_districts.txt" | Foreach {$_.LastWriteTime}
Run Code Online (Sandbox Code Playgroud)
哪个输出像这样
12/18/2018 16:54:32
Run Code Online (Sandbox Code Playgroud)
但我希望它像这样输出
12/18/2018 4:54 PM
Run Code Online (Sandbox Code Playgroud)
有什么办法可以做到吗?
小智 8
使用 DateTime 对象格式。更多信息在这里
$GAIBC = Get-Item "C:\Users\nosho\Documents\Paradox Interactive\Stellaris\mod\gaibc\common\districts\02_rural_districts.txt" | Foreach {$_.LastWriteTime.ToString("MM/dd/yyyy hh:mm:ss tt")}
Run Code Online (Sandbox Code Playgroud)