I am trying to convert 3 $datapoint. streams from UTC to CST.
The value [$datapoint.bcs_time_first_unit_assigned] comes in as a string in the form of [Mon, 19 Dec 2022 22:37:59 GMT], Day, Date, Month, Year, Hour, Minutes, Seconds.
Looking at other similar threads I think I need to convert that string to a useable date value and then add the 6 hours to it. Or I've tried using the Now() command to just render the time into the local endpoint user time.
So far I have this, but its not returning anything useful.
var dateInitial = $datapoint.bcs_time_first_unit_assigned;
$datapoint.bcs_time_first_unit_arrived;
$datapoint.bcs_response_time_depart
// convert to date
var dateval = Date(
Left(dateInitial, 4),
Mid(dateInitial, 4, 2),
Mid(dateInitial, 6, 2)
)
var dateParse = Text(dateval, 'MM/DD/YYYY')
return dateParse
function GMTtoCST(dateParse){
return DateAdd(dateParse, -6, 'hours')
}
var d1 = Now()
var d2 = Date('2022', '5', '27', '15')
var d3 = Date('2017', '8', '11', '8')
Console(d1, GMTtoCST(d1))
Console(d2, GMTtoCST(d2))
Console(d3, GMTtoCST(d3))
return {
textColor: '',
backgroundColor: '',
separatorColor:'',
selectionColor: '',
selectionTextColor: '',
attributes: {
assigned: GMTtoCST($datapoint.bcs_time_first_unit_assigned),
arrived: GMTtoCST($datapoint.bcs_time_first_unit_arrived),
departed: GMTtoCST($datapoint.bcs_response_time_depart)
}
}
Thank you and I appreciate any help you can give.