function dateTime() { const date = new Date(); let today = date.toDateString(); let time = date.toLocaleTimeString(); document.getElementById('date-time').innerHTML = '
' + today + '
' + time + '
'; setTimeout(dateTime, 1000); } function weatherBalloon(cityID) { var apiKey = 'fad9628260a1bc2ebaaf85a7dfe800d0'; fetch('https://api.openweathermap.org/data/2.5/weather?id=' + cityID + '&appid=' + apiKey) .then(function(resp) { return resp.json() }) .then(function(data) { let tempK = parseFloat(data.main.temp); let tempC = Math.round(tempK - 273.15); let tempF = Math.round((tempK - 273.15) * 1.8) + 32; document.getElementById('weather').innerHTML = '' + data.name + '
' + data.weather[0].description + '|' + tempC + '°C
'; }); } function traichu() { dateTime(); weatherBalloon(6254926); }