From 662b635ef966e3ed025bb8d61f6966bc6ccefb67 Mon Sep 17 00:00:00 2001 From: Alexa V <239999+axelavargas@users.noreply.github.com> Date: Tue, 8 Apr 2025 17:43:08 +0200 Subject: [PATCH] Docs: Standard Datetime units limited to millisecond precision (#103610) * Docs: Add information about timestamp format requirement in Date & time units * Apply suggestions from code review Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com> * Fix linting docs * Fixed spacing --------- Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com> --- .../configure-standard-options/index.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/sources/panels-visualizations/configure-standard-options/index.md b/docs/sources/panels-visualizations/configure-standard-options/index.md index cbbdfb570b6..fdad3c786f4 100644 --- a/docs/sources/panels-visualizations/configure-standard-options/index.md +++ b/docs/sources/panels-visualizations/configure-standard-options/index.md @@ -187,6 +187,24 @@ You can also paste a native emoji in the **Unit** drop-down and select it as a c ![A time series visualization using custom thumbs up emoji units](/media/docs/grafana/panels-visualizations/thumbsup_panel_v11.0.png) +##### Time format units + +All **Date & time** format units in Grafana (such as **Datetime ISO** or **Datetime US**) expect input values to be in milliseconds since the Unix epoch (January 1, 1970). If your data source provides timestamps in seconds, these will be incorrectly interpreted as dates very close to January 1, 1970. + +To display timestamps that are in seconds since epoch, multiply your timestamp values by 1000 using a transformation following these steps: + +1. In the panel editor, click the **Transformations** tab. +1. Click **Add transformation**. +1. Select the **Add field from calculation** transformation. +1. Set the following options: + + - **Mode** - **Binary operation** + - **Operation** + - Select your timestamp field + - Select the asterisk (`*`) for multiply by + - Enter 1000 in the **Field or Number** field + - Toggle the **Replace all fields** switch on if you want to see the calculated field. + #### Control unit scaling By default, Grafana automatically scales the unit based on the magnitude of the value. For example, if you have values of 0.14kW and 3000kW, Grafana displays them as 140W and 3MW, respectively. You can use custom units to control this behavior by setting a prefix, suffix, or custom SI unit.