Get max value and date from short and longterm statistics

Hi there,

i have a sensor which gathers the outdoor temperature. I would like to have a card that shows the alltime max and min temperature and the date it has occured.

Is the best approach to do this with SQL? Do i then have to join “statistics” and “stastistics_short_term” ?
How to display the date?

thx

To find all-time max/min temperature and date, use SQL. Query for MAX(temperature) and MIN(temperature). Find the corresponding timestamps for these values. Use your programming language to format the timestamps for display. Consider indexing temperature and timestamp columns for performance.