BigQuery - Datetime vs Timestamp

NirKa picture NirKa · Dec 8, 2017 · Viewed 9.6k times · Source

I looked on the documentation for google big query data types, checking the differences between TimeStamp to Datetime data types.

As I understand the main difference is:

Unlike Timestamps, a DATETIME object does not refer to an absolute instance in time. Instead, it is the civil time, or the time that a user would see on a watch or calendar.

So when should I use Timestamp/Datetime?

Thanks

Answer

Tim Swast picture Tim Swast · Dec 9, 2017

In most cases you will want to use the timestamp data type. It refers to an absolute point in time. BigQuery interprets any timezone information and represents the time internally as a UTC timestamp.

Very rarely would you use a datetime data type, which is a date and a time but no time zone. The example I like to give is that you'd use a datetime to represent pi day, 2017, since it occurs at 2017-03-14 15:09:26.535898 in each time zone separately.