Here's what I see - it's seems to me that the single-digit months (and single-digit days) are screwing this up, so it's possible that using ParseExact is not the correct approach here.
Any thoughts?
I'd say 'M/d/yyyy h:mm:ss tt' (single M, single d, single h) would catch both single and double digits.
Andrea
Let PowerShell do the work for you.
$_.LastSignInDate = ( $_.LastSignInDate -as [DateTime] ).ToString( 'yyyy-MM-dd' )
--
You received this message because you are subscribed to the Google Groups "ntpowershell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
ntpowershell...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ntpowershell/CADy1Ce5%2B0ifdQ8V2MZcPTz37MshH%2BM6o%3D2RY24kj%2B_bWxNkuYQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/97a137a50ff64733bb8030fee2d260e4%40smithcons.com.
tl/dr: it’s not just you 😊
I find it a lot when I’m looking at my older PS. It’s rather surprising to remember that PowerShell (nee’ Monad) has been around since 2006.
It takes some time to learn (and learn to use) all of it. There are parts of it that I still rarely use (e.g., filters and classes) that would probably make some of my modern code much simpler.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/CADy1Ce7wpO9wKRM1VDa7pxebTWSBTghLJifT0E6CfvvZR5CT_Q%40mail.gmail.com.