BigQuery and observable - Datetime handling

Hey All,

I use simple query to extract dates BQ (stored in UTC TZ) and in BQ console they come out properly showing me UTC datetimes. Query which run from observable returns data automatically converted from UTC to my local timezone. How to avoid this behavior? Thanks!

Hello again!

We parse the date times so that they’re more immediately useful in your notebook. The default behavior for browser-based datetime parsing is to convert it to your browser’s time zone. I’m assuming they’re still correct, just offset?

There are two ways to handle this:

  1. Keep them in Date objects, but format/convert into UTC time for display. I’ve sketched out how this could work in https://observablehq.com/d/6a24869ef5735fe9. This has the most flexibility if you want to format them specially in your notebook.

  2. Cast them to a string in your SQL with CAST(date AS STRING) and they should come back as simple strings in your notebook.

I hope that helps?