Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.
   1  <?php
   2  /**
   3   * Copyright 2012-2017 Horde LLC (http://www.horde.org/)
   4   *
   5   * See the enclosed file LICENSE for license information (LGPL). If you
   6   * did not receive this file, see http://www.horde.org/licenses/lgpl21.
   7   *
   8   * @category  Horde
   9   * @copyright 2012-2017 Horde LLC
  10   * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
  11   * @package   Imap_Client
  12   */
  13  
  14  /**
  15   * Object representation of an IMAP date string (RFC 3501 [9]).
  16   *
  17   * @author    Michael Slusarz <slusarz@horde.org>
  18   * @category  Horde
  19   * @copyright 2012-2017 Horde LLC
  20   * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
  21   * @package   Imap_Client
  22   */
  23  class Horde_Imap_Client_Data_Format_Date extends Horde_Imap_Client_Data_Format
  24  {
  25      /**
  26       * Constructor.
  27       *
  28       * @param mixed $data  Either a DateTime object, or a date format that
  29       *                     can be converted to a DateTime object.
  30       *
  31       * @throws Exception
  32       */
  33      public function __construct($data)
  34      {
  35          if (!($data instanceof DateTime)) {
  36              $data = new Horde_Imap_Client_DateTime($data);
  37          }
  38  
  39          parent::__construct($data);
  40      }
  41  
  42      /**
  43       */
  44      public function __toString()
  45      {
  46          return $this->_data->format('j-M-Y');
  47      }
  48  
  49  }