Obtaining weather station data from a MySQL database
You SQL commands seem rather overelaborated. Let me first rewrite it in a more readable way:

SELECT DATE_FORMAT(date,'%H:%i'), dht22_temp 
FROM weather 
INNER JOIN 
  (SELECT max(dht22_temp) as ts 
  FROM weather 
  WHERE date(date) = curdate()) 
AS ds ON weather.dht22_temp = ds.ts 
ORDER BY date DESC 
LIMIT 1


If I understand it correctly it seems you want to know at what time today the maximum temperate was reached and what that temperature was. You use the table weather with date and dht22_temp columns. In contrast to what you might think, I would start by splitting this command in two parts:

SELECT idweather, dht22_temp
FROM weather
WHERE date(date) = curdate()
ORDER BY dht22_temp DESC
LIMIT 1


This will execute quite fast and return the maximum temperature today, and the row where that maximum occured. Please make sure dht22_temp is properly indexed. Also note that this assumes that there's only 1 maximum. This might not be correct, and you can check that by reading more rows (increase LIMIT). Now you can check all kind of stuff that happened when the temperature was at its maximum:

SELECT *
FROM weather
WHERE idweather = &lt;id of max temp&gt;


This is very simple, but it gives you all the weather parameters when the temperature was at its maximum, including the time at which it occured. A lot of data in two simple steps.

Don't overcomplicate your SQL. But the main point is: Use your auto increment index!

I am, of course, making a point here. Once you've seen that we can rewrite the two SQL commands into a single one, reducing it to what was needed:

SELECT DATE_FORMAT(date,'%H:%i') as time, dht22_temp
FROM weather
WHERE date(date) = curdate()
ORDER BY dht22_temp DESC
LIMIT 1    


And doesn't that look much simpler? In your case however I would just grab the data for one whole day:

SELECT *
FROM weather
WHERE date(date) = curdate()


and read it in an array. Then do the manipulation, like sorting, in memory. You could even make a histogram this way, without having to access the database again.