Skip to content
Tutorials Center
My learning

Topics

Lesson 28 of 37 ยท Dashboards and Variables

Grafana Time Ranges, Time Zones and Auto Refresh Explained

Master the Grafana time picker: relative ranges like now-6h and now/d, rounding, time zones, week start, auto refresh, minimum refresh interval and URL parameters.

Every panel on a dashboard answers a question about a time window, so the time range is the most important control on the page. Grafana lets you choose it from a quick list, type absolute dates, or write short relative expressions like now-6h or now/d. This lesson explains the syntax, the rounding rules, time zones, and auto refresh.

Grafana is not available here, so we describe the picker in words and use a Python stand-in to evaluate expressions against a fixed "now". Grafana's own parser is more complete, but the rules shown here are the same ones you use every day.

The time picker

At the top right of every dashboard you find:

  • the time range picker (a clock icon with the current range). Click it to see Quick ranges (Last 5 minutes, Last 24 hours, Last 7 days, Today so far, This week...), an Absolute time range form with From and To fields and a calendar, and Recently used ranges.
  • the refresh picker with a Refresh button and a dropdown of intervals (Off, 5s, 10s, 30s, 1m, 5m...).
  • a time zone button inside the picker (Change time settings).
  • zoom buttons: zoom out (doubles the range around its center), move back and forward, and the shortcut t followed by an arrow or z to zoom. Dragging on a graph to select a region zooms in to that range.

Selecting a range updates the URL (from=now-6h&to=now), so you can share it.

Relative time syntax

Both From and To accept an expression:

  • now: the current moment.
  • now-6h, now-30m, now-7d, now+1h: add or subtract a number of units. Units are s seconds, m minutes, h hours, d days, w weeks, M months, y years. Note that minutes are lowercase m and months uppercase M.
  • / followed by a unit rounds the time: now/d is the start of today (or the end of today when used in the To field, which is why "Today" is now/d to now/d). now/w is the start of the week, now/M the start of the month.
  • You can combine them: now-1d/d means yesterday, now-1M/M is last month.

Typical pairs:

Meaning From To
Last 6 hours now-6h now
Today so far now/d now
Whole of today now/d now/d
Yesterday now-1d/d now-1d/d
Previous week now-1w/w now-1w/w
This month so far now/M now
Next 24 hours now now+24h

Rounding on From means "start of that unit"; rounding on To means "end of that unit". This is why "Yesterday" uses the same expression on both sides.

Python Stand-in: evaluate Grafana-style time expressions

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check the output: "Yesterday" spans exactly one day because the To rounding goes to the end of that day.

Time zones and week start

Grafana stores time in UTC, but it displays it in a time zone. The order of precedence is: dashboard setting (Dashboard settings > General > Time options > Time zone), then the user's preference, then the organization default, then the browser time zone. Options are Browser time, Coordinated Universal Time, or any named zone such as Europe/Berlin. Setting dashboards for a distributed team to UTC avoids arguments about when an incident started.

In the same Time options group you find:

  • Auto refresh: the list of intervals shown in the refresh picker.
  • Now delay: a lag subtracted from now, useful when data arrives late. now-1m ensures you do not draw a half-empty last minute.
  • Hide time picker.
  • Week start: Monday, Sunday or Saturday. This changes what now/w means.
  • Fiscal year start month: enables now/fQ (fiscal quarter) and now/fy.

Relative expressions use the time zone too: now/d is the start of the day in the zone selected, not in UTC.

Auto refresh

The refresh picker reloads panels at a fixed interval. Every refresh re-runs all visible queries, so keep these rules in mind:

  • Pick an interval that matches how often data actually changes. If metrics are scraped every minute, 5s refresh is wasteful.
  • The administrator sets a minimum refresh interval (min_refresh_interval in the [dashboards] section of grafana.ini, default 5s). A dashboard cannot refresh faster than that; the server protects data sources this way.
  • Refresh pauses when the browser tab is hidden in many setups, and large dashboards may take longer than the interval to load; Grafana will not start a second refresh while one is still running.
  • You can fix the default refresh in the dashboard settings (refresh in the JSON) or per link with refresh=30s in the URL.
Python Stand-in: enforce a minimum refresh interval

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Per-panel overrides

Relative time and time shift in the query options change a panel's window independent of the dashboard. For example, a "Last hour" stat on a "Last 7 days" dashboard, or a panel shifted back by 1w to compare with last week. Annotation queries ignore panel-level overrides, and variables that refresh on time range change re-run whenever the picker changes.

flowchart LR
    P["Time picker<br/>from / to"] --> V["Variables<br/>(refresh on range change)"]
    P --> Q["Panel queries"]
    O["Relative time / time shift"] --> Q
    R["Auto refresh"] --> Q
    Q --> G["Panels"]

The picker, per-panel options and refresh all feed the queries.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does now/d mean in the From field?

    A slash followed by a unit rounds down to the start of that unit (in the selected time zone).
  2. 2. Which pair of expressions shows yesterday only?

    Rounding From to the start and To to the end of the same day gives the whole day.
  3. 3. In relative time syntax, how do you write 3 months ago?

    Lowercase m is minutes; uppercase M is months.
  4. 4. What does the min_refresh_interval server setting do?

    It protects data sources by stopping dashboards from refreshing faster than the limit.

Summary

  • The picker offers quick ranges, absolute ranges and relative expressions such as now-6h and now/d.
  • /unit rounds to the start (From) or end (To) of that unit; m is minutes, M is months.
  • Time zone, week start, fiscal year and now delay are dashboard time options; UTC avoids confusion.
  • Auto refresh reruns all queries and is capped by the administrator's minimum refresh interval.
  • Per-panel relative time and time shift override the dashboard range for single panels.

Next: Alert Rules