Forum Discussion
Anonymous
2 years agoNot applicable
Escaping, truncating and combining dates.
I have a call to an API that includes a "Start" and "End" time. The entire call looks like this. start=2023-12-11T12%3A00%3A00.000Z&end=2023-12-13T12%3A00%3A00.000Z&timeline=time-series-classific...
Anonymous
2 years agoNot applicable
So I managed to muddle thru this and came up with this. It seems to work but can anyone tell me if I'm breaking in cardinal rules?
let
CurrentHour = Time.Hour(DateTime.LocalNow()),
CurrentDate2 = DateTime.LocalNow(),
CurrentHourYes = if CurrentHour > 6 then CurrentDate2 else Date.AddDays(CurrentDate2,-1),
CurrentStartTime = Date.StartOfDay(CurrentHourYes) +#duration(0,6,0,0),
StartTimeText = DateTime.ToText(CurrentStartTime,"yyyy-MM-dd"&"T"&"HH:mm:ss.fff"),
EndTimeText = DateTime.ToText(DateTime.LocalNow(),"yyyy-MM-dd"&"T"&"HH:mm:ss.fff"),
StartTime = Uri.EscapeDataString(StartTimeText),
EndTime = Uri.EscapeDataString(EndTimeText),
Param1 = "start="&StartTime&"Z",
Param2 = "&end="&EndTime&"Z",
Param3 = "&timeline=time-series-classification",
Param4 = "&device=ame-INTEGREX200-IV-9c1185",