I've got an interesting problem for ya!
Scenario:
- Column "PLN_STRT_DT" in the data source is in ISO8601 format (yyyy-mm-ddThh:MM:ssZ)
- I'm using some handy dandy code to make the Combobox tied to this column more user friendly:
SortByColumns(
GroupBy(
AddColumns(
Distinct(
colAllRecords,
PLN_STRT_DT
),
"planStartDateFormatted",
Text(DateTimeValue(Result), "[$-en-US] mm/yyyy") //<--ISSUE IS HERE
),
"planStartDateFormatted",
"test"
),
"planStartDateFormatted",
Ascending
)
The problem:
- I'm finding that the PowerApps DateTimeValue() function is converting the raw timestamp of:
- 2022-01-01T00:00:00Z to
- 2021-12-31 4:00PM (UTC - 8hrs which is PST where I'm sitting).
- This causes problems with the GroupBy() logic.
The question:
- How do I use TimezoneOffset() with DateTimeValue() to keep the times aligned?
Example:
- From within a Gallery, here is (LEFT) DateTimeValue(Text(Trim(ThisItem.PLN_STRT_DT), "mm/dd/yyyy")) and (RIGHT) ThisItem.PLN_STRT_DT.
- I need the LEFT value to be 12/31/2021, NOT 12/30/2021

Really becomes apparent here where the issue causes data to fall into different YEARS, not just days:

It looks like DateTimeOffset() only works with DateAdd() function? Its counterintuitive for me to use DateAdd() rather than Text(DateTimeValue(Result), "mm/yyyy") to convert the timestamp.
Thoughts?
Thank you