src/Marando/AstroDate/Traits/FormatTrait.php
public function format($format) {
    // Persist format
    $this->format = $format;

    // Escape format key letters and escaped characters
    $format = preg_replace('/([a-zA-Z])/', '%$1', $format);
    $format = preg_replace('/\\\\%(.)/', '\\\\$1', $format);

    /////////
    // DAY //
    /////////

    $this->format_d($format);
    $this->formatD($format);
    $this->format_j($format);
    $this->format_l($format);
    $this->formatL($format);
    $this->formatN($format);
    $this->formatS($format);
    $this->format_w($format);
    $this->format_z($format);

    //////////
    // WEEK //
    //////////

    $this->formatW($format);

    ///////////
    // MONTH //
    ///////////

    $this->formatF($format);
    $this->format_m($format);
    $this->formatM($format);
    $this->format_n($format);
    $this->format_t($format);

    //////////
    // YEAR //
    //////////

    $this->formatY($format);
    $this->format_y($format);

    //////////
    // TIME //
    //////////

    $this->format_a($format);
    $this->formatA($format);
    $this->format_g($format);
    $this->formatG($format);
    $this->format_h($format);
    $this->formatH($format);
    $this->format_i($format);
    $this->format_s($format);
    $this->format_u($format);

    //////////////
    // TIMEZONE //
    //////////////

    $this->format_e($format);
    $this->formatO($format);
    $this->formatP($format);
    $this->formatZ($format);

    ///////////
    // OTHER //
    ///////////

    $this->format_r($format);
    $this->format_c($format);
    $this->formatC($format);

    // Replace escape character and return formatted string
    return str_replace('\\', '', $format);
  }
public function format($format) {
    // Persist format
    $this->format = $format;

    // Escape format key letters and escaped characters
    $format = preg_replace('/([a-zA-Z])/', '%$1', $format);
    $format = preg_replace('/\\\\%(.)/', '\\\\$1', $format);

    /////////
    // DAY //
    /////////

    $this->format_d($format);
    $this->formatD($format);
    $this->format_j($format);
    $this->format_l($format);
    $this->formatL($format);
    $this->formatN($format);
    $this->formatS($format);
    $this->format_w($format);
    $this->format_z($format);

    //////////
    // WEEK //
    //////////

    $this->formatW($format);

    ///////////
    // MONTH //
    ///////////

    $this->formatF($format);
    $this->format_m($format);
    $this->formatM($format);
    $this->format_n($format);
    $this->format_t($format);

    //////////
    // YEAR //
    //////////

    $this->formatY($format);
    $this->format_y($format);

    //////////
    // TIME //
    //////////

    $this->format_a($format);
    $this->formatA($format);
    $this->format_g($format);
    $this->formatG($format);
    $this->format_h($format);
    $this->formatH($format);
    $this->format_i($format);
    $this->format_s($format);
    $this->format_u($format);

    //////////////
    // TIMEZONE //
    //////////////

    $this->format_e($format);
    $this->formatO($format);
    $this->formatP($format);
    $this->formatZ($format);

    ///////////
    // OTHER //
    ///////////

    $this->format_r($format);
    $this->format_c($format);
    $this->formatC($format);

    // Replace escape character and return formatted string
    return str_replace('\\', '', $format);
  }
Formats this instance to a string based on a PHP DateTime format string. A
few additional formats have been added for the AstroDate library, for more
informatin see the documentation.

@param  string $format Format, e.g. 'D, d M Y H:i:s'
@return string http://php.net/manual/en/function.date.php
@see