How to force a time value to be in a specific format

Hello,

In my dashboard, I display a date in a timestamp format to see when an SSL Certificate will expire.
My first problem was that my values are displayed like that : “4047588” (it’s a timestamp in seconds that indicate that the certificate will expire in 6.69 weeks). To fix that, I selected the Unit “seconds” in standard options. Now it displays “6.69 weeks” which is fine.

image

To fine tune my dashboard, I want to force the time to be displayed in number of days instead of adapting of the value and display weeks.

Anyone have a suggestion ?

Thanks !

Hi,

Unfortunatelly, I don’t think you can with Grafana’s presets. According to Chat GPT, Grafana will always auto adjust to the value that makes the most sense. You can however calculate the number of days from seconds (by dividing seconds by 86400) and setting a custom unit Days (you’d have to type it in by hand and select custom unit). Notice you can also do this directly in the datasource, if your datasource allows it.

This will have one disadvantage for sure - when you’ll be left with one, you’ll still have “Days”, not “Day”.

1 Like