sijocherian / google-bigquery

Automatically exported from code.google.com/p/google-bigquery
0 stars 0 forks source link

TIME difference between timestamps #248

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
how to get time difference between two TIMESTAMPs in bigquery?

ex : i want to get time difference (in Seconds) between these two time stamp 

2013-04-07 10:21:25 UTC 

2013-04-07 10:21:57 UTC

Please help me with some solution.

Original issue reported on code.google.com by Nabler.O...@gmail.com on 20 May 2015 at 8:14

GoogleCodeExporter commented 9 years ago
I think TIMESTAMP_TO_SEC(ts2) - TIMESTAMP_TO_SEC(ts1) would do the trick.

See https://cloud.google.com/bigquery/query-reference#datetimefunctions for 
more info.

(And BTW, for questions about usage rather than bugs, I'd suggest posting to 
StackOverflow under the "google-bigquery" tag.)

Original comment by jcon...@google.com on 20 May 2015 at 3:32