Let's say I have an array of objects:
$data = @(
[pscustomobject]@{Id1='1';Id2=51213412;ID3='00:01:00'}
[pscustomobject]@{Id1='1';Id2=51213412;ID3='00:02:00'}
[pscustomobject]@{Id1='1';Id2=51213412;ID3='00:04:00'}
[pscustomobject]@{Id1='1';Id2=51213412;ID3='00:04:00'}
[pscustomobject]@{Id1='1';Id2=51213412;ID3='00:02:00'}
[pscustomobject]@{Id1='2';Id2=11112314;ID3='00:01:00'}
[pscustomobject]@{Id1='2';Id2=11112314;ID3='00:02:00'}
[pscustomobject]@{Id1='2';Id2=11112314;ID3='00:03:00'}
[pscustomobject]@{Id1='2';Id2=11112314;ID3='00:01:00'}
[pscustomobject]@{Id1='3';Id2=12512521;ID3='00:01:00'}
[pscustomobject]@{Id1='2';Id2=11112314;ID3='00:02:00'}
[pscustomobject]@{Id1='4';Id2=42112521;ID3='00:01:00'}
[pscustomobject]@{Id1='2';Id2=11112314;ID3='00:03:00'}
[pscustomobject]@{Id1='3';Id2=12512521;ID3='00:02:00'}
[pscustomobject]@{Id1='4';Id2=42112521;ID3='00:02:00'}
[pscustomobject]@{Id1='1';Id2=51213412;ID3='00:03:00'}
[pscustomobject]@{Id1='4';Id2=42112521;ID3='00:01:00'}
[pscustomobject]@{Id1='3';Id2=12512521;ID3='00:05:00'}
[pscustomobject]@{Id1='4';Id2=42112521;ID3='00:03:00'}
[pscustomobject]@{Id1='3';Id2=12512521;ID3='00:01:00'}
[pscustomobject]@{Id1='2';Id2=11112314;ID3='00:02:00'}
[pscustomobject]@{Id1='4';Id2=42112521;ID3='00:01:00'}
[pscustomobject]@{Id1='2';Id2=11112314;ID3='00:03:00'}
[pscustomobject]@{Id1='3';Id2=12512521;ID3='00:02:00'}
[pscustomobject]@{Id1='3';Id2=12512521;ID3='00:04:00'}
[pscustomobject]@{Id1='1';Id2=51213412;ID3='00:05:00'}
[pscustomobject]@{Id1='4';Id2=42112521;ID3='00:01:00'}
[pscustomobject]@{Id1='3';Id2=12512521;ID3='00:05:00'}
[pscustomobject]@{Id1='5';Id2=53252352;ID3='00:01:00'})
I would like to convert property ID3, that is time to display only minutes so I can ultimately make a sum of them. I found a code that can convert it to minutes:
$minutes = foreach ($mins in $data.ID3) {
$TimeSpan = [System.TimeSpan]::Parse($mins)
[System.Math]::Round($TimeSpan.TotalMinutes,0)}
But now I get the results in $minutes variable. What is the fastest way to replace ID3 values with converted value?