I have the following powershell script in order to update a value in table storage:
[string]$filter = `
[Microsoft.Azure.Cosmos.Table.TableQuery]::GenerateFilterCondition("Query",`
[Microsoft.Azure.Cosmos.Table.QueryComparisons]::Equal,"(Type = 'FTE')")
$user = Get-AzTableRow `
-table $cloudTable `
-customFilter $filter
# Change the entity.
$user.LastRunTime = "2022-04-24T01:09:30.4224457Z"
$user | Update-AzTableRow -table $cloudTable
With this update, I see LastRunTime in 'String' format. How do I update this to 'DateTime' format.
CodePudding user response:
It's a string because what you're setting it to is a string. You should set it to a DateTimeOffset
.
$user.LastRunTime = [System.DateTimeOffset]"2022-04-24T01:09:30.4224457Z"