Looker Studio Function : CURRENT_DATETIME

Category: DATE function

The CURRENT_DATETIME() function in Looker Studio returns the current date and time based on the viewer’s timezone. It’s widely used in reports that require real-time analysis and is essential for comparing current metrics against historical data.

Purpose of the CURRENT_DATETIME Function

1. Data Distribution Analysis :

CURRENT_DATETIME() helps track how data changes over time, allowing analysts to monitor real-time distribution across dimensions like location, device type, or campaign. It’s essential in time-sensitive data visualization.

2. Customer Segmentation :
Using the current date and time, businesses can segment customers based on recent activity or interaction. For example, grouping users active in the last 7 days allows for more targeted marketing.

3. Decision Making :

Decision-makers rely on up-to-date data. CURRENT_DATETIME() ensures reports reflect the most current insights, allowing for timely business decisions based on the latest trends and customer behavior.

 

Type of Calculation & Practical Use Cases

Performance Benchmarking

Compare current performance against previous time periods.

Customer Segmentation

 Identify and group users based on recency of interaction.

Time Series Analysis

Align metrics dynamically with today’s date for better trend analysis.


CURRENT_DATETIME()

ParameterTypeDescription
(None)N/ACURRENT_DATETIME() does not take any parameter.

How Does the CURRENT_DATE TIME Function Work?

The CURRENT_DATE() function retrieves the current date from Looker Studio’s environment. It does not rely on your system clock but on the server-side timezone of the data source. It’s recalculated every time a report is loaded.


When Should You Use CURRENT _DATETIME Function?

  • To filter data from the last 7, 30, or 90 days.

  • To track performance relative to “now”.

  • To calculate freshness or recency of data.

  • In any use case requiring real-time or rolling date calculations.

Example of  CURRENT_DATETIME with Result

Example : 1 Basic Usage
DATETIME_DIFF(CURRENT_DATETIME(), Order_Date, DAY)

Example 2: Column Usage 

Use CURRENT_DATETIME() in calculated fields to create dynamic columns such as “Days Since Purchase” or “Is Recent Customer”.

Example 3: Handling Decimals and Scientific Notation

While CURRENT_DATETIME() returns date-time values, when used in time difference calculations, ensure you format results to avoid decimals. Use functions like ROUND() or FORMAT_DATETIME() to clean outputs.

Example 4: Combining with Other Functions

  • With DATETIME_DIFF(): Calculate the age of a record.

  • With DATETIME_SUB(): Create rolling windows.

  • With IF(): Create flags for recent users or events.

Tips and Tricks

  • Use in filters to show “last X days”.

  • Great for automating dashboards with real-time context.

  • Pair with DATETIME_SUB() for past date ranges.

  • Ensure consistent timezone across data sources.

  • Use FORMAT_DATETIME() for custom date output.

1. Can I use CURRENT_DATETIME() for rolling reports?

Yes, CURRENT_DATETIME() is perfect for rolling reports. It dynamically captures the current date and time, helping create real-time filters like “last 7 days” or “past 30 days” in dashboards.

2. Is timezone considered in CURRENT_DATETIME()?

Yes, it considers the viewer’s timezone or the data source settings. This ensures date-time values are accurate for users in different regions, making time-based filters and calculations more reliable and consistent.

3. Does CURRENT_DATETIME() update automatically?

Yes, every time someone views the report, CURRENT_DATETIME() refreshes to reflect the exact current date and time, enabling real-time data monitoring without needing manual updates.

4. Can I compare CURRENT_DATETIME() to another datetime field?

Absolutely. You can compare it using functions like DATETIME_DIFF() to calculate the difference between now and a past date, which is useful for aging reports or recent activity tracking.

5. Is CURRENT_DATETIME() available in all data sources?

It works in most standard Looker Studio connectors. However, some custom or third-party connectors may have limitations or may not support all datetime functions, so always verify compatibility first.