truncateTimeColumn(unit: 1d) - How to keep today date after aggregate

When I’m doing truncate Time on a Day basis, my today day is updated by the day before.

How to trunc timecolumn time and to keep the date without taking into account the time

Here my query result without truncatetimeColumn the date of today is correct (2022-10-02)

Here my query result when I add truncateTimeColumn(unit: 1d)
On my last line, the date is not any more the today date (2022-10-02) but replaced by (2022-10-01)

@Franck_Bellot Something is changing on that last line between the two screenshots. The values of all columns in the first 3 rows are the same between the screenshots, but there are small difference in the last line between the two screenshots. Not really sure what’s going on here, but I believe the truncateTimeColumn() is working correctly, but something about the last line is changing.

The date of today is not anymore today but yesterday after using trunctimecolumn, that is why my last line is the same date that previous one.
The values of columns change because is live data.
Its stange that when we useTruncatimecolumn using 1dparameter, the today daye is replaced by fhe day before.

Its stange that when we useTruncatimecolumn using 1dparameter, the today daye is replaced by fhe day before.

It shouldn’t be. When I do a straight truncation of the timestamp in your screenshot, I get the correct expected day (run in a Flux REPL):

import "date"

date.truncate(t: 2022-10-02T20:55:29.809Z, unit: 1d)

// Returns 2022-10-02T00:00:00.000000000Z

Thanks @scott, it’s working well :wink: