LaPhi
LaPhi

Reputation: 5887

PowerShell - Converting Date

How can I convert the Date 20131213113850.0Z to a date object? Is there a build in command to convert for the get-date commandlet?

Thanks in advance!

Upvotes: 3

Views: 520

Answers (1)

Keith Hill
Keith Hill

Reputation: 201602

I'm guessing a bit on the interpretation of the digit to the right of the decimal but does this get you there:

[DateTime]::ParseExact('20131213113850.0Z', 'yyyyMMddhhmmss.fK', $null)

The K specifier will convert the time to the local time zone. Not sure if that is what you want or not.

Upvotes: 7

Related Questions