Forum Discussion

Andre Radtke's avatar
Andre Radtke
Brass Contributor
Jan 26, 2022
Solved

Convert a text string to a correct date time format

Hello folks,

 

I have maybe a simple question for the experienced people around here 🙂 . I have a runbook in azure that is getting the field "CreatedDateTime" of a unified group (Teams Team). The format of this field ist like the following "2020-08-06T06:03:19Z". This is not recognized as a valid DateTime format by the cmdlet:

$DateTime=[Datetime]::ParseExact($DateTime'MM/dd/yyyy'$null)
 
Can anyone point me to a solution how to get the string "2020-08-06T06:03:19Z" into a string like "2020-08-06" or "06-08-2020". Every hint is appreciated.
 
Thank you all 😉

4 Replies

No RepliesBe the first to reply

Resources