提供されたAPIを使用して画面に予測を出力するために、openweathermap APIをいじっています。
私がやろうとしているのは、将来または過去の特定の時間の予測を取得することです。この情報は、API 呼び出しの結果で確認できます。この情報を取得する方法がわかりませんか?UNIXタイムスタンプと人間が読める形式のようですが、APIでこの予測を特定の時間に出力する方法を確認できますか?
ありがとう
Example API code
http://api.openweathermap.org/data/2.5/forecast?lat=51.5072&lon=0.1275&units=metric
Example forecast "dt_txt":"2013-09-14 00:00:00"},{"dt":1379127600,
Example web page
<html>
<head>
<title>Weather</title>
<meta charset="utf-8">
<script src="http://code.jquery.com/jquery-1.7.min.js" ></script>
<script src="http://code.jquery.com/ui/1.7.0/jquery-ui.js" ></script>
<script>
function getWeather(callback) {
var weather = 'http://api.openweathermap.org/data/2.5/forecast?lat=51.5072&lon=0.1275&units=metric';
$.ajax({
dataType: "jsonp",
url: weather,
success: callback
});
}
// get data:
getWeather(function (data) {
console.log('weather data received');
console.log(data.list[0].weather[0].description);
console.log(data.list[0].weather[0].main);
});
getWeather(function (data) {
document.write('weather data received');
document.write('<br>');
document.write(data.list[0].weather[0].description);
document.write('<br>');
document.write(data.list[0].weather[0].main);
document.write('<br>');
document.write(data.list[0].main.temp);
document.write('<br>');
});
</script>
</body>
</html>