<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Date
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Date.php 2504 2011-12-28 07:35:29Z liu21st $
*/
/**
* Include needed Date classes
*/
require_once 'Zend/Date/DateObject.php';
require_once 'Zend/Locale.php';
require_once 'Zend/Locale/Format.php';
require_once 'Zend/Locale/Math.php';
/**
* @category Zend
* @package Zend_Date
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Date extends Zend_Date_DateObject
{
private $_locale = null;
// Fractional second variables
private $_fractional = 0;
private $_precision = 3;
private static $_options = array(
'format_type' => 'iso', // format for date strings 'iso' or 'php'
'fix_dst' => true, // fix dst on summer/winter time change
'extend_month' => false, // false - addMonth like SQL, true like excel
'cache' => null, // cache to set
'timesync' => null // timesync server to set
);
// Class wide Date Constants
const DAY = 'dd';
const DAY_SHORT = 'd';
const DAY_SUFFIX = 'SS';
const DAY_OF_YEAR = 'D';
const WEEKDAY = 'EEEE';
const WEEKDAY_SHORT = 'EEE';
const WEEKDAY_NARROW = 'E';
const WEEKDAY_NAME = 'EE';
const WEEKDAY_8601 = 'eee';
const WEEKDAY_DIGIT = 'e';
const WEEK = 'ww';
const MONTH = 'MM';
const MONTH_SHORT = 'M';
const MONTH_DAYS = 'ddd';
const MONTH_NAME = 'MMMM';
const MONTH_NAME_SHORT = 'MMM';
const MONTH_NAME_NARROW = 'MMMMM';
const YEAR = 'y';
const YEAR_SHORT = 'yy';
const YEAR_8601 = 'Y';
const YEAR_SHORT_8601 = 'YY';
const LEAPYEAR = 'l';
const MERIDIEM = 'a';
const SWATCH = 'B';
const HOUR = 'HH';
const HOUR_SHORT = 'H';
const HOUR_AM = 'hh';
const HOUR_SHORT_AM = 'h';
const MINUTE = 'mm';
const MINUTE_SHORT = 'm';
const SECOND = 'ss';
const SECOND_SHORT = 's';
const MILLISECOND = 'S';
const TIMEZONE_NAME = 'zzzz';
const DAYLIGHT = 'I';
const GMT_DIFF = 'Z';
const GMT_DIFF_SEP = 'ZZZZ';
const TIMEZONE = 'z';
const TIMEZONE_SECS = 'X';
const ISO_8601 = 'c';
const RFC_2822 = 'r';
const TIMESTAMP = 'U';
const ERA = 'G';
const ERA_NAME = 'GGGG';
const ERA_NARROW = 'GGGGG';
const DATES = 'F';
const DATE_FULL = 'FFFFF';
const DATE_LONG = 'FFFF';
const DATE_MEDIUM = 'FFF';
const DATE_SHORT = 'FF';
const TIMES = 'WW';
const TIME_FULL = 'TTTTT';
const TIME_LONG = 'TTTT';
const TIME_MEDIUM = 'TTT';
const TIME_SHORT = 'TT';
const DATETIME = 'K';
const DATETIME_FULL = 'KKKKK';
const DATETIME_LONG = 'KKKK';
const DATETIME_MEDIUM = 'KKK';
const DATETIME_SHORT = 'KK';
const ATOM = 'OOO';
const COOKIE = 'CCC';
const RFC_822 = 'R';
const RFC_850 = 'RR';
const RFC_1036 = 'RRR';
const RFC_1123 = 'RRRR';
const RFC_3339 = 'RRRRR';
const RSS = 'SSS';
const W3C = 'WWW';
/**
* Generates the standard date object, could be a unix timestamp, localized date,
* string, integer, array and so on. Also parts of dates or time are supported
* Always set the default timezone: http://php.net/date_default_timezone_set
* For example, in your bootstrap: date_default_timezone_set('America/Los_Angeles');
* For detailed instructions please look in the docu.
*
* @param string|integer|Zend_Date|array $date OPTIONAL Date value or value of date part to set
* ,depending on $part. If null the actual time is set
* @param string $part OPTIONAL Defines the input format of $date
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
* @return Zend_Date
* @throws Zend_Date_Exception
*/
public function __construct($date = null, $part = null, $locale = null)
{
if (is_object($date) and !($date instanceof Zend_TimeSync_Protocol) and
!($date instanceof Zend_Date)) {
if ($locale instanceof Zend_Locale) {
$locale = $date;
$date = null;
$part = null;
} else {
$date = (string) $date;
}
}
if (($date !== null) and !is_array($date) and !($date instanceof Zend_TimeSync_Protocol) and
!($date instanceof Zend_Date) and !defined($date) and Zend_Locale::isLocale($date, true, false)) {
$locale = $date;
$date = null;
$part = null;
} else if (($part !== null) and !defined($part) and Zend_Locale::isLocale($part, true, false)) {
$locale = $part;
$part = null;
}
$this->setLocale($locale);
if (is_string($date) && ($part === null) && (strlen($date) <= 5)) {
$part = $date;
$date = null;
}
if ($date === null) {
if ($part === null) {
$date = time();
} else if ($part !== self::TIMESTAMP) {
$date = self::now($locale);
$date = $date->get($part);
}
}
if ($date instanceof Zend_TimeSync_Protocol) {
$date = $date->getInfo();
$date = $this->_getTime($date['offset']);
$part = null;
} else if (parent::$_defaultOffset != 0) {
$date = $this->_getTime(parent::$_defaultOffset);
}
// set the timezone and offset for $this
$zone = @date_default_timezone_get();
$this->setTimezone($zone);
// try to get timezone from date-string
if (!is_int($date)) {
$zone = $this->getTimezoneFromString($date);
$this->setTimezone($zone);
}
// set datepart
if (($part !== null && $part !== self::TIMESTAMP) or (!is_numeric($date))) {
// switch off dst handling for value setting
$this->setUnixTimestamp($this->getGmtOffset());
$this->set($date, $part, $this->_locale);
// DST fix
if (is_array($date) === true) {
if (!isset($date['hour'])) {
$date['hour'] = 0;
}
$hour = $this->toString('H');
$hour = $date['hour'] - $hour;
switch ($hour) {
case 1 :
case -23 :
$this->addTimestamp(3600);
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
PHP实例开发源码—最新php淘宝客优惠券网站源码.zip (2000个子文件)
php_xxtea.c 6KB
xxtea.c 2KB
web.config 582B
web.config 420B
CREDITS 53B
common.css 185KB
a.css 161KB
global.css 157KB
global.css 144KB
style_v3.css 87KB
zdm.css 78KB
pg-register.css 74KB
pwater.css 49KB
ueditor.css 45KB
global.css 43KB
alert.css 39KB
reg.css 38KB
articleread.css 37KB
style.css 35KB
ueditor.min.css 34KB
good.css 32KB
pg-zone.css 32KB
md-nav-good.css 30KB
pg-item.css 30KB
view.css 30KB
dtk.css 28KB
page.css 27KB
base.css 26KB
tags.css 25KB
md-goodslist.css 25KB
a.css 24KB
alert.css 22KB
alert.css 22KB
moudle.css 22KB
zhuce.css 22KB
video-js.css 22KB
alert.css 21KB
default.css 21KB
articlezdm.css 21KB
view.css 21KB
md-list.css 20KB
brand_list.css 20KB
md-public.css 20KB
pro1.0.2.css 20KB
global.css 19KB
index-min.css 19KB
user.css 19KB
user.css 19KB
image.css 19KB
user.css 19KB
dianpu.css 18KB
sellers_seller(1).css 18KB
goods.css 18KB
good.css 17KB
dedecms.css 17KB
global.css 17KB
global.css 17KB
pg-index.css 17KB
items.css 16KB
a_002.css 16KB
video.css 15KB
alert.css 15KB
list.css 15KB
public.css 14KB
login.css 14KB
pg-jd-store.css 14KB
layer.css 14KB
jp.bag.css 12KB
layout.css 12KB
pg-try.css 12KB
shang.css 11KB
video-js.min.css 11KB
loginreg.css 11KB
detail.css 11KB
loginreg.css 11KB
ui-dialog.css 10KB
tehui.css 9KB
baoming.css 9KB
baoming.css 8KB
zhelib.css 7KB
shCoreDefault.css 7KB
tmall.css 7KB
new.css 7KB
login.css 7KB
que.css 7KB
brand.css 6KB
login.css 6KB
pg-index.css 6KB
base.css 6KB
pg-down.css 6KB
te_dialog.css 6KB
base.css 6KB
sellers_seller.css 6KB
calendar-blue.css 6KB
index1.0.1.css 5KB
new_body.css 5KB
kefu.css 5KB
kefu.css 5KB
gift.css 5KB
gift.css 5KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
毕业_设计
- 粉丝: 1980
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- sensors-18-03721.pdf
- Facebook.apk
- 推荐一款JTools的call-this-method插件
- json的合法基色来自红包东i请各位
- 项目采用YOLO V4算法模型进行目标检测,使用Deep SORT目标跟踪算法 .zip
- 针对实时视频流和静态图像实现的对象检测和跟踪算法 .zip
- 部署 yolox 算法使用 deepstream.zip
- 基于webmagic、springboot和mybatis的MagicToe Java爬虫设计源码
- 通过实时流协议 (RTSP) 使用 Yolo、OpenCV 和 Python 进行深度学习的对象检测.zip
- 基于Python和HTML的tb商品列表查询分析设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功