Notification

This article is about Looker Studio. For Looker documentation, visit https://cloud.google.com/looker/docs/intro.

HOUR

Returns the hour of a date.

Sample usage

HOUR(Date)

Syntax

1) Returns the hour from a Date & Time value.

HOUR(datetime_expression)

2) Returns the hour from a compatibility mode Date value.

HOUR(X [,Input Format])

Parameters

  • datetime_expression - a Date & Time field or expression.
  • X - a field or expression that evaluates to Text, Number, or compatibility mode Date.
  • Input Format - format for X. Optional if X is correctly configured as a semantic date field.

Input format for compatibility mode dates

DAY accepts the following input formats if X is a Text field or expression, or compatibility mode Date:

  • Any valid strptime format is accepted.
  • 'BASIC': %Y/%m/%d-%H:%M:%S
  • 'DEFAULT_DASH': %Y-%m-%d [%H:%M:%S]
  • 'DEFAULT_SLASH': %Y/%m/%d [%H:%M:%S]
  • 'DEFAULT_DECIMAL': %Y%m%d [%H:%M:%S
  • 'RFC_1123': for example, Sat, 24 May 2008 20:09:47 GMT
  • 'RFC_3339': for example, 2008-05-24T20:09:47Z
  • 'DECIMAL_DATE': same as 'DEFAULT_DECIMAL'

DAY accepts the following input format if X is a Number field or expression:

  • 'SECONDS': seconds since Epoch
  • 'MILLIS': milliseconds since Epoch
  • 'MICROS': microseconds since Epoch
  • 'NANOS': nanoseconds since Epoch
  • 'JULIAN_DATE': days since Epoch

Examples

Formula Input Output
HOUR(Date) Jan 1, 2019 0
HOUR(Date as Text, 'BASIC') 2019/01/01-09:40:45 9
HOUR(Date as Number, 'SECONDS') 1561784874 5

HOUR(Date as lots of Numbers, 'MILLIS')

1562004058620 18

Notes

This function works with both compatibility mode dates and upgraded Date and Date & Time data types.

Was this helpful?

How can we improve it?
true
Get Looker Studio Pro

Upgrade now to get all the features of Looker Studio that you already know, plus enhanced enterprise capabilities and technical support

Search
Clear search
Close search
Google apps
Main menu
18321605376064658981
true
Search Help Center
true
true
true
true
true
102097