当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Locale_Format::getDate方法代码示例

本文整理汇总了PHP中Zend_Locale_Format::getDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Locale_Format::getDate方法的具体用法?PHP Zend_Locale_Format::getDate怎么用?PHP Zend_Locale_Format::getDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Locale_Format的用法示例。


在下文中一共展示了Zend_Locale_Format::getDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createForm

 public function createForm($id_hopdong)
 {
     $kh = new Model_Hopdong();
     $hopdong = $kh->getWhereIdHopDong($id_hopdong);
     $this->setDisableLoadDefaultDecorators(true);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'formnoindex/hopdong_layout.phtml')), 'Form'));
     $data = new My_Data();
     $opMau = $data->getOptionMau();
     $opLoaiVai = $data->getOptionLoaiVai();
     $opNCC = $data->getOptionNCC();
     $tenhopdong = $this->createElement('text', 'tenhopdong', array('decorators' => array('ViewHelper')));
     $mota = $this->createElement('text', 'mota', array('decorators' => array('ViewHelper')));
     $ngayky = $this->createElement('text', 'ngayky', array('decorators' => array('ViewHelper')));
     $sotansoi = $this->createElement('text', 'sotansoi', array('decorators' => array('ViewHelper')));
     $thanhtien = $this->createElement('text', 'thanhtien', array('decorators' => array('ViewHelper')));
     $mamau = $this->createElement('select', 'mamau', array('multioptions' => $opMau, 'decorators' => array('ViewHelper')));
     $maloaivai = $this->createElement('select', 'maloaivai', array('multioptions' => $opLoaiVai, 'decorators' => array('ViewHelper')));
     $manhacungcap = $this->createElement('select', 'manhacungcap', array('multioptions' => $opNCC, 'decorators' => array('ViewHelper')));
     $them = $this->createElement('submit', 'them', array('decorators' => array('ViewHelper'), 'label' => 'Chỉnh sửa'));
     $mydate = Zend_Locale_Format::getDate($hopdong['NgayKy'], array("date_format" => "yyyy.MM.dd"));
     $date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year'];
     $tenhopdong->setAttrib('class', 'formEdit')->setValue($hopdong['TenHopDong']);
     $mota->setAttrib('class', 'formEdit')->setValue($hopdong['MoTa']);
     $ngayky->setAttrib('class', 'formEdit')->setValue($date_str);
     $sotansoi->setAttrib('class', 'formEdit')->setValue($hopdong['SoTanSoi']);
     $thanhtien->setAttrib('class', 'formEdit')->setValue($hopdong['ThanhTien']);
     $mamau->setAttrib('class', 'formEdit')->setValue($hopdong['MaMau']);
     $maloaivai->setAttrib('class', 'formEdit')->setValue($hopdong['MaLoaiVai']);
     $manhacungcap->setAttrib('class', 'formEdit')->setValue($hopdong['MaNhaCungCap']);
     $this->addElement($tenhopdong)->addElement($mota)->addElement($ngayky)->addElement($sotansoi)->addElement($thanhtien)->addElement($mamau)->addElement($maloaivai)->addElement($manhacungcap)->addElement($them);
 }
开发者ID:LongNguyen-51101909,项目名称:Dimopla,代码行数:31,代码来源:hopdong.php

示例2: LocalizedToNormalized

 public function LocalizedToNormalized($value)
 {
     if (substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2) != 'en') {
         $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     } else {
         $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_LONG);
     }
     $_options = array('locale' => Mage::app()->getLocale()->getLocaleCode(), 'date_format' => $dateFormatIso, 'precision' => null);
     return Zend_Locale_Format::getDate($value, $_options);
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:10,代码来源:Data.php

示例3: createForm

 public function createForm($id_cm)
 {
     $kh = new Model_Donxuat();
     $donxuat = $kh->getWhere($id_cm);
     $this->setDisableLoadDefaultDecorators(true);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/donxuat_layout.phtml')), 'Form'));
     $tendonxuat = $this->createElement('text', 'tendonxuat', array('decorators' => array('ViewHelper')));
     $ngayxuat = $this->createElement('text', 'ngayxuat', array('decorators' => array('ViewHelper')));
     $them = $this->createElement('submit', 'them', array('decorators' => array('ViewHelper'), 'label' => 'Chỉnh sửa'));
     $mydate = Zend_Locale_Format::getDate($donxuat[0]['NgayXuat'], array("date_format" => "yyyy.MM.dd"));
     $date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year'];
     $tendonxuat->setAttrib('class', 'formEdit')->setValue($donxuat[0]['TenDonXuat']);
     $ngayxuat->setAttrib('class', 'formEdit')->setValue($date_str);
     $this->addElement($tendonxuat)->addElement($ngayxuat)->addElement($them);
 }
开发者ID:LongNguyen-51101909,项目名称:Zend1Example,代码行数:15,代码来源:donxuat.php

示例4: createForm

 public function createForm($id_donhang)
 {
     $kh = new Model_Donhang();
     $donhang = $kh->getWhere($id_donhang);
     $this->setDisableLoadDefaultDecorators(true);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'formnoindex/donhang_layout.phtml')), 'Form'));
     $tendonhang = $this->createElement('text', 'tendonhang', array('decorators' => array('ViewHelper')));
     $ngaydathang = $this->createElement('text', 'ngaydathang', array('decorators' => array('ViewHelper')));
     $tiendathang = $this->createElement('text', 'tiendathang', array('decorators' => array('ViewHelper')));
     $sometvai = $this->createElement('text', 'sometvai', array('decorators' => array('ViewHelper')));
     $them = $this->createElement('submit', 'them', array('decorators' => array('ViewHelper'), 'label' => 'Chỉnh sửa'));
     $tendonhang->setAttrib('class', 'textmedium')->setValue($donhang['TenDonHang']);
     $mydate = Zend_Locale_Format::getDate($donhang['NgayDat'], array("date_format" => "yyyy.MM.dd"));
     $date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year'];
     $ngaydathang->setAttrib('class', 'textmedium')->setValue($date_str);
     $tiendathang->setAttrib('class', 'textmedium')->setValue($donhang['TienDatHang']);
     $sometvai->setAttrib('class', 'textmedium')->setValue($donhang['SoMetVai']);
     $this->addElement($tendonhang)->addElement($ngaydathang)->addElement($tiendathang)->addElement($sometvai)->addElement($them);
 }
开发者ID:LongNguyen-51101909,项目名称:Zend1Example,代码行数:19,代码来源:donhang.php

示例5: createForm

 public function createForm($id_lonhuom)
 {
     $kh = new Model_Lonhuom();
     $lonhuom = $kh->getWhere($id_lonhuom);
     $this->setDisableLoadDefaultDecorators(true);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/lonhuom_layout.phtml')), 'Form'));
     $data = new My_Data();
     $opMau = $data->getOptionMau();
     $tenlonhuom = $this->createElement('text', 'tenlonhuom', array('decorators' => array('ViewHelper')));
     $ngaynhuom = $this->createElement('text', 'ngaynhuom', array('decorators' => array('ViewHelper')));
     $mamau = $this->createElement('select', 'mamau', array('decorators' => array('ViewHelper'), 'multioptions' => $opMau));
     $them = $this->createElement('submit', 'them', array('decorators' => array('ViewHelper'), 'label' => 'Chỉnh sửa'));
     $mydate = Zend_Locale_Format::getDate($lonhuom[0]['NgayNhuom'], array("date_format" => "yyyy.MM.dd"));
     $date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year'];
     $tenlonhuom->setAttrib('class', 'formEdit')->setValue($lonhuom[0]['TenLoNhuom']);
     $ngaynhuom->setAttrib('class', 'formEdit')->setValue($date_str);
     $mamau->setAttrib('class', 'formEdit')->setValue($lonhuom[0]['MaMau']);
     $this->addElement($tenlonhuom)->addElement($ngaynhuom)->addElement($mamau)->addElement($them);
 }
开发者ID:LongNguyen-51101909,项目名称:Zend1Example,代码行数:19,代码来源:lonhuom.php

示例6: _checkFormat

 private function _checkFormat($value)
 {
     try {
         require_once 'Zend/Locale/Format.php';
         $parsed = Zend_Locale_Format::getDate($value, array('date_format' => $this->_format, 'format_type' => 'iso', 'fix_date' => false));
         if (isset($parsed['year']) and (strpos(strtoupper($this->_format), 'YY') !== false and strpos(strtoupper($this->_format), 'YYYY') === false)) {
             $parsed['year'] = Zend_Date::getFullYear($parsed['year']);
         }
     } catch (Exception $e) {
         // Date can not be parsed
         return false;
     }
     if ((strpos($this->_format, 'Y') !== false or strpos($this->_format, 'y') !== false) and !isset($parsed['year'])) {
         // Year expected but not found
         return false;
     }
     if (strpos($this->_format, 'M') !== false and !isset($parsed['month'])) {
         // Month expected but not found
         return false;
     }
     if (strpos($this->_format, 'd') !== false and !isset($parsed['day'])) {
         // Day expected but not found
         return false;
     }
     if ((strpos($this->_format, 'H') !== false or strpos($this->_format, 'h') !== false) and !isset($parsed['hour'])) {
         // Hour expected but not found
         return false;
     }
     if (strpos($this->_format, 'm') !== false and !isset($parsed['minute'])) {
         // Minute expected but not found
         return false;
     }
     if (strpos($this->_format, 's') !== false and !isset($parsed['second'])) {
         // Second expected  but not found
         return false;
     }
     // Date fits the format
     return true;
 }
开发者ID:hackingman,项目名称:TubeX,代码行数:39,代码来源:Date.php

示例7: Model_Donhang

<?php

echo $this->headMeta();
echo $this->headLink();
$dh = new Model_Donhang();
$donhang = $dh->getAll();
$data = new My_Data();
$dh = $donhang;
if ($dh) {
    $title = array("Tên Đơn Hàng", "Ngày Đặt", "Tiền Đặt Hàng", "Số Mét Vải", "Khách Hàng", "Tùy Chỉnh", "Hợp Đồng Đã Tạo", "Tạo Hợp Đồng");
    $content = array();
    foreach ($dh as $item) {
        $subcontent = array();
        $mydate = Zend_Locale_Format::getDate($item['NgayDat'], array("date_format" => "yyyy.MM.dd"));
        $date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year'];
        $kh = new Model_Khachhang();
        $khachhang = $kh->getWhere($item['MaKhachHang'])[0];
        $subcontent[] = "<a href='" . HOST_PROJECT . "/index/main/khachhang_detail/true/makhachhang/" . $item['MaKhachHang'] . "/'>" . $item['TenDonHang'] . "</a>";
        $subcontent[] = $date_str;
        $subcontent[] = $item['TienDatHang'];
        $subcontent[] = $item['SoMetVai'];
        $subcontent[] = $khachhang['TenKhachHang'];
        $subcontent[] = '<a href="' . HOST_PROJECT . "/index/chinhsua/donhang/true/makhachhang/" . $item['MaKhachHang'] . "/madonhang/" . $item['MaDonHang'] . '/option/donhang">Sửa</a>&nbsp|&nbsp' . '<a href="' . HOST_PROJECT . "/index/xoa/donhang/true/makhachhang/" . $item['MaKhachHang'] . "/madonhang/" . $item["MaDonHang"] . '/option/xem/" onclick="return confirm(' . "'bạn có chắc muốn xóa ?'" . ')">Xóa</a>';
        $hopdong = $data->getHopDong($item['MaDonHang']);
        $hd_old = "chưa tạo";
        if ($hopdong) {
            $hd_old = "";
            foreach ($hopdong as $hd_item) {
                $hd_old .= "<a href='" . HOST_PROJECT . "/index/main/hopdong_detail/true/mahopdong/" . $hd_item['MaHopDong'] . "/'>" . $hd_item['TenHopDong'] . "</a>,&nbsp<br>";
            }
        }
开发者ID:LongNguyen-51101909,项目名称:Dimopla,代码行数:31,代码来源:donhang_xem.php

示例8: _date

 /**
  * Returns the calculated date
  *
  * @param  string                    $calc    Calculation to make
  * @param  string|integer|Zend_Date  $date    Date to calculate with, if null the actual date is taken
  * @param  string                    $format  Date format for parsing
  * @param  string|Zend_Locale        $locale  Locale for parsing input
  * @return integer|Zend_Date  new date
  * @throws Zend_Date_Exception
  */
 private function _date($calc, $date, $format, $locale)
 {
     if (is_null($date)) {
         throw new Zend_Date_Exception('parameter $date must be set, null is not allowed');
     }
     if ($locale === null) {
         $locale = $this->getLocale();
     }
     if ($date instanceof Zend_Date) {
         // extract date from object
         $date = $date->get(Zend_Date::DATE_MEDIUM, $locale);
     } else {
         if (self::$_Options['format_type'] == 'php') {
             $format = Zend_Locale_Format::convertPhpToIsoFormat($format);
         }
         try {
             $parsed = Zend_Locale_Format::getDate($date, array('date_format' => $format, 'locale' => $locale, 'format_type' => 'iso'));
         } catch (Zend_Locale_Exception $e) {
             throw new Zend_Date_Exception($e->getMessage());
         }
         $date = new Zend_Date(0, Zend_Date::TIMESTAMP, $locale);
         $date->set($parsed['year'], Zend_Date::YEAR);
         $date->set($parsed['month'], Zend_Date::MONTH);
         $date->set($parsed['day'], Zend_Date::DAY);
         $date = $date->get(Zend_Date::DATE_MEDIUM, $locale);
     }
     $return = $this->_calcdetail($calc, $date, Zend_Date::DATE_MEDIUM, $locale);
     if ($calc != 'cmp') {
         return $this;
     }
     return $return;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:42,代码来源:Date.php

示例9: Model_Hopdong

<?php

echo $this->headMeta();
echo $this->headLink();
$hd = new Model_Hopdong();
$hopdongall = $hd->getAll();
$data = new My_Data();
if ($hopdongall) {
    $maincontent = array();
    $data = new My_Data();
    $title = array("Mã Hợp Đồng", "Số Tấn Sợi", "Thành Tiền", "Ngày Ký", "Loại Sợi", "Kho Sợi", "Nhà Cung Cấp", "Tùy Chỉnh", "Nhập Kho");
    foreach ($hopdongall as $hopdong) {
        $mydate = Zend_Locale_Format::getDate($hopdong['NgayMua'], array("date_format" => "yyyy.MM.dd"));
        $date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year'];
        $op = $data->getOpHopdong($hopdong['MaSoi'], $hopdong['MaKho'], $hopdong['MaNhaCungCap']);
        $button = "<a class ='thembutton' href='" . HOST_PROJECT . "/index/nhaplieu/nhapsoi/true/mahopdong/" . $hopdong['MaHopDong'] . "'/>Nhập Kho</a>";
        $chinhsua = '<a href="' . HOST_PROJECT . "/index/chinhsua/hopdong/true/mahopdong/" . $hopdong['MaHopDong'] . '/option/hopdong/">Sửa</a>&nbsp|&nbsp' . '<a href="' . HOST_PROJECT . "/index/xoa/hopdong/true/mahopdong/" . $hopdong['MaHopDong'] . '/option/xem/" onclick="return confirm(' . "'bạn có chắc muốn xóa ?'" . ')">Xóa</a>';
        $nhapkho = "";
        if ($hopdong['TrangThai'] == 1) {
            $nhapkho = "Đã Nhập";
        } else {
            $nhapkho = $button;
        }
        $content = array($hopdong['MaHopDong'], $hopdong['SoTanSoi'], $hopdong['ThanhTien'], $date_str, $op['tensoi'], $op['tenkho'], $op['tenncc'], $chinhsua, $nhapkho);
        $maincontent[] = $content;
    }
    $table = $data->createTable($title, $maincontent, "1100px");
    echo $table;
} else {
    echo "<div class='message'>";
    echo "Chưa tồn tại Hợp Đồng";
开发者ID:LongNguyen-51101909,项目名称:Dimopla,代码行数:31,代码来源:hopdong_xem.php

示例10: _date

 /**
  * Returns the calculated date
  *
  * @param  string                    $calc    Calculation to make
  * @param  string|integer|Zend_Date  $date    Date to calculate with, if null the actual date is taken
  * @param  string                    $format  Dateformat for parsing
  * @param  string|Zend_Locale        $locale  Locale for parsing input
  * @return integer|Zend_Date  new date
  * @throws Zend_Date_Exception
  */
 private function _date($calc, $date, $format, $locale)
 {
     if (is_null($date)) {
         throw new Zend_Date_Exception('parameter $date must be set, null is not allowed');
     }
     if ($locale === null) {
         $locale = $this->getLocale();
     }
     if ($calc == 'set' or $calc == 'cmp') {
         $gmt = $this->setGmt(false);
     } else {
         $gmt = $this->setGmt(true);
     }
     if ($date instanceof Zend_Date) {
         // extract date from object
         $date = $date->get(Zend_Date::DATE_MEDIUM, $locale);
     } else {
         $parsed = Zend_Locale_Format::getDate($date, $format, $locale);
         $date = new Zend_Date(0, Zend_Date::TIMESTAMP, $locale);
         $date->setGmt(true);
         $date->set($parsed['year'], Zend_Date::YEAR);
         $date->set($parsed['month'], Zend_Date::MONTH_SHORT);
         $date->set($parsed['day'], Zend_Date::DAY);
         $date = $date->get(Zend_Date::DATE_MEDIUM, $locale);
     }
     $return = $this->_calcdetail($calc, $date, Zend_Date::DATE_MEDIUM, $locale);
     $this->setGmt($gmt);
     if ($calc != 'cmp') {
         return $this;
     }
     return $return;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:42,代码来源:Date.php

示例11: toDateTimeInterval

 public function toDateTimeInterval($start, $end, $options = array())
 {
     $start = $this->_checkDateTime($start, @$options['timezone']);
     $end = $this->_checkDateTime($end, @$options['timezone']);
     if (!$start || !$end) {
         return false;
     }
     unset($options['timezone']);
     $options = array_merge(array('locale' => $this->getLocale(), 'format' => 'MEd'), $options);
     $options['locale'] = 'ja';
     $format = Zend_Locale_Data::getContent($options['locale'], 'dateinterval', $options['format']);
     var_dump(Zend_Locale_Format::getDate($start, array('format' => $format)));
     die;
     if (preg_match('/^(.+?)(\\s*[–-~]\\s*)(.+?)$/iu', $format, $matches)) {
         var_dump($matches);
         die;
     } else {
         // Sigh
         echo 'zzz';
     }
     var_dump($format);
     var_dump($start->toString($format, $this->getLocale()));
     die;
 }
开发者ID:robeendey,项目名称:ce,代码行数:24,代码来源:Locale.php

示例12: fromString

 /**
  * @deprecated Use new Date($string, $format) or new Date($string, $locale) instead!
  * @param string $string
  * @param string | \Zend_Locale $format
  * @return Date The new date
  */
 public static function fromString($string, $format = null)
 {
     if ($string == null) {
         return null;
     }
     if (is_null($format) || $format instanceof \Zend_Locale) {
         $locale = null;
         if (!is_null($format)) {
             $locale = $format;
         }
         if (is_null($locale)) {
             if (\Zend_Registry::isRegistered('\\Zend_Locale')) {
                 $locale = \Zend_Registry::get('\\Zend_Locale');
             } else {
                 $locale = new \Zend_Locale();
             }
         }
         $dateParts = \Zend_Locale_Format::getDate($string, array('date_format' => $format, 'locale' => $locale));
         return new Date($dateParts);
     }
     return new Date($string, $format);
 }
开发者ID:pago,项目名称:pantr,代码行数:28,代码来源:Date.php

示例13: Model_Lonhuom

<?php

echo $this->headMeta();
echo $this->headLink();
$ln = new Model_Lonhuom();
$lonhuomall = $ln->getAll();
if ($lonhuomall) {
    $maincontent = array();
    $title = array("Mã Lô", "Ngày Nhuộm", "Màu", "Số Cây Nhuộm", "Tùy Chỉnh", "Trạng Thái");
    $data = new My_Data();
    foreach ($lonhuomall as $lonhuom) {
        if (!$lonhuom['TrangThai']) {
            $mydate = Zend_Locale_Format::getDate($lonhuom['NgayNhuom'], array("date_format" => "yyyy.MM.dd"));
            $date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year'];
            $cm = new Model_Caymoc();
            $caymoc = $cm->getWhere_lonhuom($lonhuom['MaLoNhuom']);
            $trangthai = "<a class ='buttontim' href='#'/>Đang Nhuộm</a>";
            $content = array($lonhuom['MaLoNhuom'], $date_str, $data->getNameMau($lonhuom['MaMau']), $lonhuom['SoCayNhuom'], '<a href="' . HOST_PROJECT . "/index/chinhsua/lonhuom/true/malonhuom/" . $lonhuom['MaLoNhuom'] . '/option/lonhuom">Sửa</a>&nbsp|&nbsp' . '<a href="' . HOST_PROJECT . "/index/xoa/lonhuom/true/malonhuom/" . $lonhuom['MaLoNhuom'] . '/option/lonhuom" onclick="return confirm(' . "'bạn có chắc muốn xóa ?'" . ')">Xóa</a>', $trangthai);
            $maincontent[] = $content;
        }
    }
    $table = $data->createTable($title, $maincontent, "730px");
    echo $table;
} else {
    echo "<div class='message'>";
    echo "Chưa tồn tại Lô Nhuộm";
    echo "</div>";
}
开发者ID:LongNguyen-51101909,项目名称:Zend1Example,代码行数:28,代码来源:lonhuom_xem.php

示例14: isDate

 /**
  * Checks if the given date is a real date or datepart.
  * Returns false is a expected datepart is missing or a datepart exceeds its possible border.
  * But the check will only be done for the expected dateparts which are given by format.
  * If no format is given the standard dateformat for the actual locale is used.
  * f.e. 30.February.2007 will return false if format is 'dd.MMMM.YYYY'
  *
  * @param  string              $date    Date to parse for correctness
  * @param  string              $format  OPTIONAL Format for parsing the date string
  * @param  string|Zend_Locale  $locale  OPTIONAL Locale for parsing date parts
  * @return boolean             True when all date parts are correct
  */
 public static function isDate($date, $format = null, $locale = null)
 {
     if (Zend_Locale::isLocale($format)) {
         $locale = $format;
         $format = null;
     }
     if ($locale === null) {
         $locale = new Zend_Locale();
         $locale = $locale->toString();
     }
     if ($format === null) {
         $format = Zend_Locale_Format::getDateFormat($locale);
     } else {
         if (self::$_Options['format_type'] == 'php') {
             $format = Zend_Locale_Format::convertPhpToIsoFormat($format);
         }
     }
     try {
         $parsed = Zend_Locale_Format::getDate($date, array('locale' => $locale, 'date_format' => $format, 'format_type' => 'iso', 'fix_date' => false));
     } catch (Zend_Locale_Exception $e) {
         // date can not be parsed
         return false;
     }
     if ((strpos($format, 'Y') !== false or strpos($format, 'y') !== false) and !isset($parsed['year'])) {
         // year expected but not found
         return false;
     }
     if (strpos($format, 'M') !== false and !isset($parsed['month'])) {
         // month expected but not found
         return false;
     }
     if (strpos($format, 'd') !== false and !isset($parsed['day'])) {
         // day expected but not found
         return false;
     }
     if ((strpos($format, 'H') !== false or strpos($format, 'h') !== false) and !isset($parsed['hour'])) {
         // hour expected but not found
         return false;
     }
     if (strpos($format, 'm') !== false and !isset($parsed['minute'])) {
         // minute expected but not found
         return false;
     }
     if (strpos($format, 's') !== false and !isset($parsed['second'])) {
         // second expected  but not found
         return false;
     }
     // set not given dateparts
     if (!isset($parsed['hour'])) {
         $parsed['hour'] = 0;
     }
     if (!isset($parsed['minute'])) {
         $parsed['minute'] = 0;
     }
     if (!isset($parsed['second'])) {
         $parsed['second'] = 0;
     }
     if (!isset($parsed['month'])) {
         $parsed['month'] = 1;
     }
     if (!isset($parsed['day'])) {
         $parsed['day'] = 1;
     }
     if (!isset($parsed['year'])) {
         $parsed['year'] = 1970;
     }
     $date = new self($locale);
     $timestamp = $date->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $parsed['month'], $parsed['day'], $parsed['year']);
     if ($parsed['year'] != $date->date('Y', $timestamp)) {
         // given year differs from parsed year
         return false;
     }
     if ($parsed['month'] != $date->date('n', $timestamp)) {
         // given month differs from parsed month
         return false;
     }
     if ($parsed['day'] != $date->date('j', $timestamp)) {
         // given day differs from parsed day
         return false;
     }
     if ($parsed['hour'] != $date->date('G', $timestamp)) {
         // given hour differs from parsed hour
         return false;
     }
     if ($parsed['minute'] != $date->date('i', $timestamp)) {
         // given minute differs from parsed minute
         return false;
     }
//.........这里部分代码省略.........
开发者ID:dalinhuang,项目名称:popo,代码行数:101,代码来源:Date.php

示例15: filter

 /**
  * Defined by Zend_Filter_Interface
  *
  * Normalizes the given input
  *
  * @param  string $value Value to normalized
  * @return string|array The normalized value
  */
 public function filter($value)
 {
     if (Zend_Locale_Format::isNumber($value, $this->_options)) {
         return Zend_Locale_Format::getNumber($value, $this->_options);
     } else {
         if ($this->_options['date_format'] === null && strpos($value, ':') !== false) {
             // Special case, no date format specified, detect time input
             return Zend_Locale_Format::getTime($value, $this->_options);
         } else {
             if (Zend_Locale_Format::checkDateFormat($value, $this->_options)) {
                 // Detect date or time input
                 return Zend_Locale_Format::getDate($value, $this->_options);
             }
         }
     }
     return $value;
 }
开发者ID:NerdGZ,项目名称:icingaweb2,代码行数:25,代码来源:LocalizedToNormalized.php


注:本文中的Zend_Locale_Format::getDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。