Hi,
I want to have a dashboard where I can see what was the last date/time a record was processed. I created a metric that is exposed to Grafana by Prometheus that has Epoch time of last date/time a record was processed
I want to convert the timestamp to date/time (eg. DD-MM-YYYY HH:MM:SS), can someone tell me how to do it? I searched for some ways of doing it but none of them worked
Thank you
Depending on your Grafana version it should be an option to convert to time:
I tried but No Data appeared
could you toggle table view to see the raw data? also which panel type are you using and what options have you selected on? is it single stat? did you selected which values to show? I believe by default shows all numeric or _value values, and you are trying to show other, in this case “time” or maybe should be “string” ? (not sure how it is managed on Grafana UI)
Hello,
have you tried changing the unit?
Either via Standard Options
Or, override only the unit of that field
1 Like
It worked by changing the unit
Thank you for your help
1 Like
I have the similar issue. When I set the unit, the conversion returns a wrong result. For 1733875199, I get 1970-01-21 instead of 10.12.2024 GMT.
Any idea?
you need to multiply your value with 1000, as the epoch is expected in milliseconds since 1970 but 1733875199 is just seconds.
2 Likes
My timestamp is in milliseconds but when change unit to Datetime, I am getting NaN. I also tried unit time in milliseconds but that is giving me the years from 1970. What might be the issue?
Hi, can you check if your timestamp is a number, not a string (toggle table view just above the visualization. If it’s like on the screen below (with A next to the name and on the left side of the column), it’s string, not a number.
Then insert a transformation like below:
Thank you, that was the issue. I resolved it by dividing by 1 in the transformation, was wondering why it worked