/** * Construct a date object out of it's time values If a timezone string * the date will be set into that zone - defaulting to the system's * default timezone of none is given. * * @param int year * @param int month * @param int day * @param int hour * @param int minute * @param int second * @param util.TimeZone tz default NULL * @return util.Date */ public static function create($year, $month, $day, $hour, $minute, $second, TimeZone $tz = NULL) { $date = date_create(); if ($tz) { date_timezone_set($date, $tz->getHandle()); } if (FALSE === @date_date_set($date, $year, $month, $day) || FALSE === @date_time_set($date, $hour, $minute, $second)) { throw new IllegalArgumentException(sprintf('One or more given arguments are not valid: $year=%s, $month=%s, $day= %s, $hour=%s, $minute=%s, $second=%s', $year, $month, $day, $hour, $minute, $second)); } return new self($date); }