alamb commented on issue #10602:
URL: https://github.com/apache/datafusion/issues/10602#issuecomment-2122959190

   Given the statement in the description, here is the best I can come up with 
using `arrow_cast`
   
   ```sql
   -- Times in brussels
   WITH t_brussels
   AS (
     SELECT
       column1 AT TIME ZONE 'Europe/Brussels' as ts -- timestamp in specified 
timezone
     FROM t_utc
   )
   SELECT
     ts as "time in Brussels",
     date_bin(
       interval '1 day',
       arrow_cast(ts, 'Timestamp(Nanosecond, None)'),
       '2020-01-01T00:00:00Z'::timestamp
     ) as date_bin
   FROM
     t_brussels;
   
   +---------------------------+---------------------+
   | time in Brussels          | date_bin            |
   +---------------------------+---------------------+
   | 2024-04-30T23:30:00+02:00 | 2024-04-30T00:00:00 |
   | 2024-05-01T00:30:00+02:00 | 2024-04-30T00:00:00 |
   | 2024-05-01T01:30:00+02:00 | 2024-04-30T00:00:00 |
   | 2024-05-01T02:00:00+02:00 | 2024-05-01T00:00:00 |
   | 2024-05-01T02:30:00+02:00 | 2024-05-01T00:00:00 |
   | 2024-05-01T12:30:00+02:00 | 2024-05-01T00:00:00 |
   | 2024-05-01T22:30:00+02:00 | 2024-05-01T00:00:00 |
   +---------------------------+---------------------+
   7 row(s) fetched.
   Elapsed 0.004 seconds.
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to