I am having Sitecore's Date field data coming as 20230804T000000Z, I also have time coming as 11 am. The Date is coming from Sitecore date field, and time from Single-Line Text field as below.
I need to combine these two and get the date and time as this format 2023-08-04T03:02:36+00:00
I got the date and time in my PowerShell using
$field_date_range_start_date = $item.Fields["Event Start Date"]
$field_date_range_start_time =$item.Fields["Event Start Time"]
have tried using
split()but out don't help out it says this is not supportedsomething like
$year = $dateString.Substring(0, 4) $month = $dateString.Substring(4, 2) $day = $dateString.Substring(6, 2)
and concat these to get yyyy-MM-dd format but didn't work out it says Substring() is not supported
ToString("yyyy-MM-dd")also didn't help work out it says this is not supported[DateTime]::ParseExact( $field_date_range_start_date, "yyyy-MM-dd", [System.Globalization.CultureInfo]::InvariantCulture)gives error in ParseExact
Is there anyway that I can achieve converting 20230804T000000Z to yyyy-MM-dd and combining with 11 am($field_date_range_start_time) and finally get my date variable to have format used in this sample 2023-08-04T03:02:36+00:00, using Sitecore PowerShell Script as I am exporting some of my data
Thanks



