diff --git a/time-temp.php b/time-temp.php new file mode 100644 index 0000000..f1be5ea --- /dev/null +++ b/time-temp.php @@ -0,0 +1,55 @@ +current_observation; + +$tz = new DateTimeZone($obs->local_tz_long); + +$obs_date = new DateTime($obs->local_time_rfc822); + +$date = new DateTime('now', $tz); +$dst = $date->format('I'); +if ($dst === "1") { + $dst_text = "is"; +} else { + $dst_text = "is not"; +} + +if ($obs->pressure_trend == "+") { + $pres_text = "and rising"; +} elseif ($obs->pressure_trend == "-") { + $pres_text = "and falling"; +} else { + $pres_text = "and steady"; +} + +header('Content-Type: application/xml'); + +echo ' + + + The current time is '.$date->format('g:i:s A').', on '.$date->format('F j, Y').'. It is week number '.((int)$date->format('W')).' and day number '.((int)$date->format('z')).' of the year. It '.$dst_text.' currently Daylight Saving Time in '.$date->format('T').'. The temperature in '.$obs->observation_location->city.' was '.$obs->temp_f.'F today at '.$obs_date->format('g:i A').' (zyphon.com via wunderground.com) + Hello. '.$date->format('g:i:s A').' is the current time, on '.$date->format('F j, Y').'. It is week number '.((int)$date->format('W')).' and day number '.((int)$date->format('z')).' of the year. It '.$dst_text.' currently Daylight Saving Time in '.$obs->display_location->city.'. + Thank you for calling '.$obs->display_location->city.' Time and Temperature: a free hobby service, courtesy of zye fawn dot com, and Weather Underground dot com. + The temperature in '.$obs->observation_location->city.' was '.$obs->temp_f.' degrees Fahrenheit today at '.$obs_date->format('g:i A').'. The weather was '.$obs->weather.' with winds '.$obs->wind_string.'. The dew point was '.$obs->dewpoint_f.' degrees, pressure '.$obs->pressure_mb.' millibars '.$pres_text.', visibility '.$obs->visibility_mi.' miles. The temperature felt like '.$obs->feelslike_f.' degrees. + + Please press any key to hear this message again. + + Thanks again for calling. Goodbye. +'; + +