How to find timestamp of the maximum value of the metrics over the time

Hi All,

Good day

I would like to retrieve the timestamp of the highest value for a specific metric over a period of time using a Prometheus query.

Panel : Stats

Expected Output :

Time                      Threads
2023-05-12 03:00:00       2789

I have framed the below query, but it is showing the current timestamp

timestamp(max_over_time(mysql_global_status_threads_running{service_name=~"$service_name"}[$__range]))

Could you please help me on this