Mastering the SECOND Function in Looker Studio: Extraction, Usage, Examples, and Limitations

 Mastering the SECOND Function in Looker Studio: Extraction, Usage, Examples, and Limitations

Discover the power that hides within the

function in Google Data Studio. Used to extract the seconds component from a given date, the
function simplifies the time analysis process by allowing you to isolate and observe the seconds part of your data. This function is especially handy when you're dealing with precise time-based metrics or when you need granular-level details.



function carries two types of syntax:

  1. This syntax is utilized when we want to extract the seconds component from a Date & Time value:

    can be either a Date & Time field or expression.

  2. This syntax is used for compatibility mode Date value extraction. In addition,

    Input Format
    is optionally provided in case X isn't appropriately configured as a semantic date field:
    SECOND(X [,Input Format])
    can be a field or expression resulting in Text, Number, or compatibility mode Date. The
    Input Format
    is used to properly interpret the compatibility mode dates.


function supports various input formats for compatibility mode dates, ranging from 'BASIC', 'DEFAULT_DASH', 'DEFAULT_SLASH', to specific formats like 'RFC_1123', 'RFC_3339', and 'DECIMAL_DATE'. For Numeric fields or expressions, it accepts 'SECONDS', 'MILLIS', 'MICROS', 'NANOS', and 'JULIAN_DATE'.


Although the Google Data Studio

function seems simple, it's a powerful tool to use when dealing with precise time data. To use the function, simply place your Date & Time field or expression within the parentheses (), or for compatibility mode dates, provide your field/expression and optionally, the Input Format.


Say, you run an online store and want to analyze the precise time when a purchase was made. You have the transaction timestamp which you want to break down.

  1. To get the seconds part from a date-time expression that is timestamp of the transaction:


  1. Suppose the timestamp is in text format like "2022/01/01-14:20:45". To get the seconds:

SECOND("2022/01/01-14:20:45", 'BASIC')

  1. When the timestamp is stored as milliseconds since the Epoch:
    SECOND(Transaction_timestamp_millis, 'MILLIS')

Remember, the function will return a result between 0-59 which represents the seconds component of the date.

Function Limitations

Keep in mind that the

function is designed to only retrieve the 'seconds' portion of a dateime. It won't return minutes, hours, or any other components. Also, it works with both compatibility mode dates and upgraded Date and Date & Time data types.

Helpful Tips

Some tips to keep in mind:

  • Make sure to match the correct input format with the data type of your source field or expression.
  • Deployment of the
    function can be especially beneficial when coupled with other time-based functions for comprehensive time-series analysis.
  • Use
    function in calculated fields to create new metrics at granular level.

Remember, every second counts, and so does the

function in Google Data Studio! Compute wisely!

More function to use with Looker Studio

Mastering the Advanced REGEXP_REPLACE Function in Looker Studio for Effective Data Transformation and Cleanup
Mastering the SQRT Function in Looker Studio for Enhanced Data Insights and Computation
Unleashing the Power of REGEXP_MATCH in Looker Studio: A Comprehensive Guide to Parsing and Analyzing Text Data
Mastering the Use of HYPERLINK Function in Looker Studio for More Interactive Data Representation
Understanding the DATETIME Function in Looker Studio: Syntax, Functionality, and Essential Tips