3 * OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.OpenWeatherMap.org .
7 * Please see the LICENSE file distributed with this source code for further
8 * information regarding copyright and licensing.
10 * Please visit the following links to read about the usage policies and the license of
11 * OpenWeatherMap before using this class:
13 * @see http://www.OpenWeatherMap.org
14 * @see http://www.OpenWeatherMap.org/terms
15 * @see http://openweathermap.org/appid
18 namespace Cmfcmf\OpenWeatherMap\Util;
21 * The time class representing a time object.
26 * @var \DateTime The start time for the forecast.
31 * @var \DateTime The end time for the forecast.
36 * @var \DateTime The day of the forecast.
41 * Create a new time object.
43 * @param string|\DateTime $from The start time for the forecast.
44 * @param string|\DateTime $to The end time for the forecast.
48 public function __construct($from, $to = null)
51 $from = ($from instanceof \DateTime) ? $from : new \DateTime((string)$from);
52 $to = ($to instanceof \DateTime) ? $to : new \DateTime((string)$to);
53 $day = new \DateTime($from->format('Y-m-d'));
55 $from = ($from instanceof \DateTime) ? $from : new \DateTime((string)$from);
58 $to = $to->add(new \DateInterval('PT23H59M59S'));