Code:
$oldestOccurenceTimeDate = Get-Date $oldestOccurrenceBuildResult.build.finishDate

OR

$oldestOccurenceTimeDate = [DateTime]::ParseExact($oldestOccurrenceBuildResult.build.finishDate,'yyyyMMddTHHmmssZZZ',$null)


(where the variable $oldestOccurrenceBuildResult.build.finishDate contains an ISO8601 string with a timezone offset baked in, which I retrieved from the Team City API, such as, "20161116T144230-0800")

These all result in "Error: "String was not recognized as a valid DateTime.""

Google search results have been sending me around in circles. There is an option for wmi for ConvertToDateTime, but that also is not working for me. But perhaps I have the syntax wrong.

Has anyone else already had to jump through this hoop?

This is very similar to the issue I was dealing with in PHP in this thread. However this is for a totally different project in a different language, and Powershell seems to be failing me here.

I could re-parse the entire string and rebuild it for the PowerShell Get-Date command, but I'd like to avoid doing that if possible.
_________________________
Tony Fabris