arrayToISO example


  public static function createFromArray(array $date_parts$timezone = NULL, $settings = []) {
    $date_parts = static::prepareArray($date_parts, TRUE);
    if (static::checkArray($date_parts)) {
      // Even with validation, we can end up with a value that the       // DateTime class won't handle, like a year outside the range       // of -9999 to 9999, which will pass checkdate() but       // fail to construct a date object.       $iso_date = static::arrayToISO($date_parts);
      return new static($iso_date$timezone$settings);
    }
    else {
      throw new \InvalidArgumentException('The array contains invalid values.');
    }
  }

  /** * Creates a date object from timestamp input. * * The timezone of a timestamp is always UTC. The timezone for a * timestamp indicates the timezone used by the format() method. * * @param int $timestamp * A UNIX timestamp. * @param mixed $timezone * (optional) \DateTimeZone object, time zone string or NULL. See * __construct() for more details. * @param array $settings * (optional) A keyed array for settings, suitable for passing on to * __construct(). * * @return static * A new DateTimePlus object. * * @throws \InvalidArgumentException * If the timestamp is not numeric. */
Home | Imprint | This part of the site doesn't use cookies.