Djeah
Djeah

Reputation: 360

BigQuery not returning milliseconds part in timestamp

As per Google's docs https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions , using the CURRENT_TIMESTAMP() function returns the timestamp with milli/microsecond precision.

However, when I am using the same command on my Linux machine using bq I am not getting any precision in seconds. Any reason why is it so? Below is the result that I get:

+---------------------+
|         f0_         |
+---------------------+
| 2019-10-27 20:20:53 |
+---------------------+

Upvotes: 0

Views: 3809

Answers (2)

Yun Zhang
Yun Zhang

Reputation: 5503

It is just how bq command line tool displays timestamp. You can see up to microseconds on web UI: enter image description here

Upvotes: 1

Gordon Linoff
Gordon Linoff

Reputation: 1269793

This is a bit too long for a comment.

I'm pretty sure they are there. You just don't seem them. You can extract the milliseconds using extract():

select extract(millisecond from current_timestamp)

999/1000 times this will be non-zero.

Upvotes: 3

Related Questions