Format of time/date


I would like the uptime to show only the day (10, 11, 12…). My Grafana today shows day, hour, minute and second…

I already changed the system.uptime in Zabbix to uptime, timestamp, unixtime, s (seconds), d (day), but I still couldn’t put only the day…


Hi @Bruno,

Welcome to the :grafana: community support forums !!

We are excited that you joined our OSS community. Please read about some of the FAQs in the community :slight_smile:

You can use Regular Expressions in the Value Mapping function. See this post as a reference where it contains screenshots on how to define it.

For the regex part, I tested it on to get only the day from the uptime value.

For this you can put ^([0-9]+) .* in the regex part and in Display Text, just write $1 and then it should work.

Here is a screenshot from regex101

You can also play with the regex but use Golang in programming flavour as Grafana’s backend is written in it.

I hope this helps.

Thanks for you help usmanahmad

I don’t know if I did something wrong, but in my case the regex didn’t work :frowning:

Hi @Bruno

I see that you used the Value mapping but then not used the Regex but instead the default Value one.

You need to delete it and then click “+ Add a new mapping” and there select Regex

I attached a screencast (open it in a new window as will be easier to zoom in and view more clearly) and it works fine with mock data in the same format as uptime


One last trick is to create a new panel and apply the above if does not work in the existing one.

I hope this helps.

Hi usmanahmad

Unfortunately it didn’t work :frowning:
I believe that some additional configuration must be done in Zabbix.

I agree, I saw some post on the Zabbix forum related to uptime formatting.

Therefore would recommend asking in there as if this can be done on the query level then its more efficient and less network bandwidth consuming for Grafana to pull a complete dataset.

I hope this helps.

Thanks for help usmanahmad

Hi usmanahmad.

I improved the presentation, but I would like to remove that “day” and leave only the number 4. Can you tell me how to do this?

Hi @Bruno

Try to use either Regex via Transformation OR use Value Mapping (as posted here) but instead of using Regex, use Value and type day and match it with blank or space so only number will appear on the Panel !!