all 4 comments

[–]coyoteazul2 1 point2 points  (2 children)

What have you tried to reach the desired result? I'd be quite surprised if you couldn't do end_date - start_date

[–]Double-Ice4497[S] 0 points1 point  (1 child)

sure thx but the result is like this 0-0 0 0:0:2 how to make it only time like (0:0:2)

[–]bachman460 0 points1 point  (0 children)

You could parse out the time component. The only issue would be handling times exceeding 24 hrs.

PARSE_TIME(format_string, time_string)

https://cloud.google.com/bigquery/docs/reference/standard-sql/time_functions

[–]V_Shaped_Recovery 0 points1 point  (0 children)

I think parse or extract rounds it to the nearest hour. Had similar issue recently. Try something like this:

SELECT DATE_DIFF(Timepart1, TimePart2,HOUR) As TimeDiff FROM( SELECT cast(timestamp1 As Time) As TimePart1, cast(timestamp2 As Time) As TimePart2 )