Guest User

Untitled

a guest
May 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <?php
  2. class Zend_View_Helper_formataData extends Zend_View_Helper_Abstract
  3. {
  4.     /**
  5.      * Manipulador de Datas
  6.      * @var Zend_Date
  7.      */
  8.     protected static $_date = null;
  9.  
  10.     /**
  11.      * Método Principal
  12.      * @param string $value Valor para Formatação
  13.      * @param string $format Formato de Saída
  14.      * @return string Valor Formatado
  15.      */
  16.     public function formataData($value, $format = Zend_Date::DATETIME_MEDIUM)
  17.     {
  18.         $date = $this->getDate();
  19.         return $date->set($value)->get($format);
  20.     }
  21.  
  22.     /**
  23.      * Acesso ao Manipulador de Datas
  24.      * @return Zend_Date
  25.      */
  26.     public function getDate()
  27.     {
  28.         if (self::$_date == null) {
  29.             self::$_date = new Zend_Date();
  30.         }
  31.         return self::$_date;
  32.     }
  33. }
Add Comment
Please, Sign In to add comment