Tests for the current day in the specified time zone.
String identifier or alias for a time zone, such as |
|tsExpression||Optional expression to which you want to apply this function.|
isToday() standard time function test whether the times shown on the chart’s x-axis occur on the current day in the specified time zone. This function returns 1 for times from 12:00:00am through 11:59:59 of the current day, and returns 0 for all other times.
isToday() automatically adjusts its return values for daylight savings time.
isToday() is particularly useful when you want to see data values that are reported only on the current day.
Example 1: Results of isToday()
This chart shows the results of
isToday("US/Eastern"). The function returns 0 up until midnight this morning (Eastern Time), and then returns 1 for the current day. Notice that the change occurs at 9pm on the chart, because the chart’s times are shown in Pacific Time.
Example 2: Using Only Today’s Values in a Function
Consider the moving maximum for CPU load averages over a shifting 1-hour window (the orange line).
Now we want to also see the moving maximum, for CPU load averages that are reported during the current day, Asian time.
We do this by adding a new query in which we use the conditional
if(isToday("Asia/Tokyo"), ts(...)) as a parameter to
mmax(). The conditional expression returns only today’s CPU load averages.
The results of the new query appear on the chart below as a dark purple line starting at midnight Tokyo time. Notice that the moving maximums returned by the new and old queries differ at first, because they are based on different shifting time windows. Eventually the shifting time windows coincide, and the orange and purple lines converge.