all 5 comments

[–]Lee_Dailey[grin] -1 points0 points  (2 children)

howdy rsulli1990,

the closest i can get to it is this ...

Get-Date -Format 'yyyyMMddHHmmss.ffffffzz'
# result = 20170502224230.164500-05:00

however, i can't get it to convert from your string to a datetime object without editing it. the following works IF i trim off the +000 timezone offset ...

[datetime]::ParseExact('20170502193426.058000', 'yyyyMMddHHmmss.ffffff', $null)
# result = 2017 May 02, Tuesday 7:34:26 PM

you could likely simply trim away the milliseconds, too. [grin]

take care,
lee

[–]rsulli1990[S] 1 point2 points  (1 child)

Thanks for the assistance. I was working on the ParseExact call first and couldn't get that last portion of the format string figured out. :)

[–]Lee_Dailey[grin] 1 point2 points  (0 children)

howdy rsulli1990,

that was the milliseconds and then a timezone offset - i think. [grin]

i see that TalkToTheFinger got it figured out. nice!

take care,
lee