Reputation: 615
I'm working with a SharePoint list and it's common date/time format is 2020-01-06T08:09:00.0000000Z. I have source date that I'm writing to that list that's in another format, i.e. 11.07.2012 09:40.
How can I convert that string into the format that the SharePoint list expects?
Closest I've come is:
[datetime]$dateToConvert = "11.07.2012 09:40"
Get-Date -Date $dateToConvert -Format FileDateTimeUniversal
which outputs 20121107T0840000000Z
but that's missing the dashes.
Any ideas?
Upvotes: 1
Views: 863
Reputation: 692
You can try this: $dateToConvert.ToUniversalTime().ToString("o")
Upvotes: 2