VMware Cloud Community
AmoghMaheshvip
Enthusiast
Enthusiast
Jump to solution

Is it possible to change TIME FORMAT in Get-VIEvent ?

Last Created time in Get-VIEvent is in the [ dd/mm/yy hh:mm:ss am/pm ] (12 hrs format), 

Is it possible to change it into 24 hrs format?

Thank You

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

How a DateTime object is displayed by PowerShell depends on your regional settings.

You can check with

Get-Culture | select -ExpandProperty DateTimeFormat

You can always force the datetime object to a specific format.

For example like this (HH indicates a 24-hour notation)

Get-VIEvent -Start (Get-Date).AddHours(-1) |

Select @{N='Timestamp';E={$_.CreatedTime.ToString("yyyyMMdd HH:mm:ss")}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

2 Replies
LucD
Leadership
Leadership
Jump to solution

How a DateTime object is displayed by PowerShell depends on your regional settings.

You can check with

Get-Culture | select -ExpandProperty DateTimeFormat

You can always force the datetime object to a specific format.

For example like this (HH indicates a 24-hour notation)

Get-VIEvent -Start (Get-Date).AddHours(-1) |

Select @{N='Timestamp';E={$_.CreatedTime.ToString("yyyyMMdd HH:mm:ss")}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

AmoghMaheshvip
Enthusiast
Enthusiast
Jump to solution

Thank You..

it worked

0 Kudos