BigQuery - Datetime vs Timestamp

17,929

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.

Share:
17,929
NirKa
Author by

NirKa

Updated on June 18, 2022

Comments

  • NirKa
    NirKa almost 2 years

    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