How can I display current data and time in kibana canvas?

I want to add a shape element and show current data and time on it, like "2023-05-10 10:06:23" which can automatically refresh. But I can not find some function or system variables can query current time.

Does anyone know how question,think you!

Can anyone else help me, think you!

Hi @1455929251

There is a function reference that shows how to use the date function in Canvas: https://www.elastic.co/guide/en/kibana/current/canvas-function-reference.html#date_fn

An example of making a text string in a Canvas that shows the current date is:

date
| formatdate "MM/DD/YYYY HH:mm:ss"
| markdown "current time: " {context}
| render

I am not sure if there is a way to make this automatically refresh. I will ask the team if there is something that will emit a periodic trigger to make the date function return an up-to-date value.

In my experiments, I have seen the date is returned in UTC format, but I expected it to be in my current timezone.

One suggestion I've received is using Vega. You can use Vega to draw custom elements and have custom code that makes the element update itself using some timer code.

Here is the example: Clock Example | Vega

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.