Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.

How to display only hours from HH:MM:SS?

I have a duration for Total Watch Time as the following: HH:MM:SS

For example, 719:59:05

I'd like to only display 719

How can I achieve this? I've tried a bunch of different formulas, but because it's a Duration format, I'm really struggling. Any ideas?

0 1 547
1 REPLY 1

Hi,

You can utilize the REGEXP_EXTRACT function to achieve this, below extracts the first two digits at the beginning of the duration string as a separate string.

REGEXP_EXTRACT(DURATION_FIELD, r"^\d{2}")

Please refer to this page REGEXP_EXTRACT to customize the logic as needed.