I can not figure out how to convert the creationtime to normal time. Here is the output i get in excel file which is 2018-02-18T23:51:55. I would like to convert it before i sent it to csv file. Here is the current code i have . I even tried the comment out code and did not work
This is pulling multiple data and putting them in csv file.
$startDate = (Get-Date).AddDays(-7).ToString('MM/dd/yyyy')
$endDate = (Get-Date).ToString('MM/dd/yyyy')
$results = Search-UnifiedAuditLog -StartDate $startDate -EndDate $endDate -UserIds $upn
$ConvertedOutput = $results | Select-Object -ExpandProperty AuditData | ConvertFrom-Json
$ConvertedOutput | Select-Object CreationTime,UserId,Operation,ResultStatus,ClientIP #| Export-Csv $OutputFile -NoTypeInformation -Append
$ConvertedOutput | Export-Csv $OutputFile -NoTypeInformation
#@{Name='CreationTime';Expression={Get-Date $_.CreationTime -Format 'MM\dd\yyyy'},