At my work, I'm getting some dates from AD attributes that were set by other scripts in the company, but to a unfriendly format I would say.
The Strings are the following: 201710191528 Which Stand to: YYYYMMDDHHmm
I want to convert this to a Date Object but so far without success.
I though about using StringBuilder to manipulate the String first to a format I can use on Get-Date() doing the following:
$strB = New-Object System.Text.StringBuilder
$strB.Append("201710191528")
$strB.Insert(10,":")
$strB.Insert(8," ")
$strB.Insert(6,"-")
$strB.Insert(4,"-")
And this works. StringBuilder will have "2017-10-19 15:28" which is perfect for Get-Date where I can just use it will work.
Now, I will be processing thousands of strings like this regularly. Is there something more efficient? I couldn't to get it to work with string formats.
Thank you very much.