亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? adodb-time.inc.php

?? 類似youtube的視頻分享網站源碼。有后臺管理系統及模板
?? PHP
?? 第 1 頁 / 共 2 頁
字號:
<?php
/**
ADOdb Date Library, part of the ADOdb abstraction library
Download: http://php.weblogs.com/adodb_date_time_library

PHP native date functions use integer timestamps for computations.
Because of this, dates are restricted to the years 1901-2038 on Unix 
and 1970-2038 on Windows due to integer overflow for dates beyond 
those years. This library overcomes these limitations by replacing the 
native function's signed integers (normally 32-bits) with PHP floating 
point numbers (normally 64-bits).

Dates from 100 A.D. to 3000 A.D. and later
have been tested. The minimum is 100 A.D. as <100 will invoke the
2 => 4 digit year conversion. The maximum is billions of years in the 
future, but this is a theoretical limit as the computation of that year 
would take too long with the current implementation of adodb_mktime().

This library replaces native functions as follows:

<pre>	
	getdate()  with  adodb_getdate()
	date()     with  adodb_date() 
	gmdate()   with  adodb_gmdate()
	mktime()   with  adodb_mktime()
	gmmktime() with  adodb_gmmktime()45
</pre>
	
The parameters are identical, except that adodb_date() accepts a subset
of date()'s field formats. Mktime() will convert from local time to GMT, 
and date() will convert from GMT to local time, but daylight savings is 
not handled currently.

This library is independant of the rest of ADOdb, and can be used
as standalone code.

PERFORMANCE

For high speed, this library uses the native date functions where
possible, and only switches to PHP code when the dates fall outside 
the 32-bit signed integer range.

GREGORIAN CORRECTION

Pope Gregory shortened October of A.D. 1582 by ten days. Thursday, 
October 4, 1582 (Julian) was followed immediately by Friday, October 15, 
1582 (Gregorian). 

Since 0.06, we handle this correctly, so:

adodb_mktime(0,0,0,10,15,1582) - adodb_mktime(0,0,0,10,4,1582) 
	== 24 * 3600 (1 day)

=============================================================================

COPYRIGHT

(c) 2003 John Lim and released under BSD-style license except for code by jackbbs,
which includes adodb_mktime, adodb_get_gmt_different, adodb_is_leap_year
and originally found at http://www.php.net/manual/en/function.mktime.php

=============================================================================

BUG REPORTS

These should be posted to the ADOdb forums at

	http://phplens.com/lens/lensforum/topics.php?id=4

=============================================================================

FUNCTION DESCRIPTIONS


FUNCTION adodb_getdate($date=false)

Returns an array containing date information, as getdate(), but supports
dates greater than 1901 to 2038.


FUNCTION adodb_date($fmt, $timestamp = false)

Convert a timestamp to a formatted local date. If $timestamp is not defined, the
current timestamp is used. Unlike the function date(), it supports dates
outside the 1901 to 2038 range.

The format fields that adodb_date supports:

<pre>
a - "am" or "pm" 
A - "AM" or "PM" 
d - day of the month, 2 digits with leading zeros; i.e. "01" to "31" 
D - day of the week, textual, 3 letters; e.g. "Fri" 
F - month, textual, long; e.g. "January" 
g - hour, 12-hour format without leading zeros; i.e. "1" to "12" 
G - hour, 24-hour format without leading zeros; i.e. "0" to "23" 
h - hour, 12-hour format; i.e. "01" to "12" 
H - hour, 24-hour format; i.e. "00" to "23" 
i - minutes; i.e. "00" to "59" 
j - day of the month without leading zeros; i.e. "1" to "31" 
l (lowercase 'L') - day of the week, textual, long; e.g. "Friday"  
L - boolean for whether it is a leap year; i.e. "0" or "1" 
m - month; i.e. "01" to "12" 
M - month, textual, 3 letters; e.g. "Jan" 
n - month without leading zeros; i.e. "1" to "12" 
O - Difference to Greenwich time in hours; e.g. "+0200" 
r - RFC 822 formatted date; e.g. "Thu, 21 Dec 2000 16:01:07 +0200" 
s - seconds; i.e. "00" to "59" 
S - English ordinal suffix for the day of the month, 2 characters; 
   			i.e. "st", "nd", "rd" or "th" 
t - number of days in the given month; i.e. "28" to "31"
T - Timezone setting of this machine; e.g. "EST" or "MDT" 
U - seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)  
w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday) 
Y - year, 4 digits; e.g. "1999" 
y - year, 2 digits; e.g. "99" 
z - day of the year; i.e. "0" to "365" 
Z - timezone offset in seconds (i.e. "-43200" to "43200"). 
   			The offset for timezones west of UTC is always negative, 
			and for those east of UTC is always positive. 
</pre>

Unsupported:
<pre>
B - Swatch Internet time 
I (capital i) - "1" if Daylight Savings Time, "0" otherwise.
W - ISO-8601 week number of year, weeks starting on Monday 

</pre>


FUNCTION adodb_gmdate($fmt, $timestamp = false)

Convert a timestamp to a formatted GMT date. If $timestamp is not defined, the
current timestamp is used. Unlike the function date(), it supports dates
outside the 1901 to 2038 range.


FUNCTION adodb_mktime($hr, $min, $sec, $month, $day, $year)

Converts a local date to a unix timestamp.  Unlike the function mktime(), it supports
dates outside the 1901 to 2038 range. Differs from mktime() in that all parameters
are currently compulsory.

FUNCTION adodb_gmmktime($hr, $min, $sec, $month, $day, $year)

Converts a gmt date to a unix timestamp.  Unlike the function gmmktime(), it supports
dates outside the 1901 to 2038 range. Differs from gmmktime() in that all parameters
are currently compulsory.

=============================================================================

NOTES

Useful url for generating test timestamps:
	http://www.4webhelp.net/us/timestamp.php

Possible future optimizations include 

a. Using an algorithm similar to Plauger's in "The Standard C Library" 
(page 428, xttotm.c _Ttotm() function). Plauger's algorithm will not 
work outside 32-bit signed range, so i decided not to implement it.

b. Iterate over a block of years (say 12) when searching for the 
correct year.

c. Implement daylight savings, which looks awfully complicated, see
	http://webexhibits.org/daylightsaving/


CHANGELOG
- 3 March 2003 0.08
Added support for 'S' adodb_date() format char. Added constant ADODB_ALLOW_NEGATIVE_TS
if you want PHP to handle negative timestamps between 1901 to 1969.

- 27 Feb 2003 0.07
All negative numbers handled by adodb now because of RH 7.3+ problems.
See http://bugs.php.net/bug.php?id=20048&edit=2

- 4 Feb 2003 0.06
Fixed a typo, 1852 changed to 1582! This means that pre-1852 dates
are now correctly handled.

- 29 Jan 2003 0.05

Leap year checking differs under Julian calendar (pre 1582). Also
leap year code optimized by checking for most common case first.

We also handle month overflow correctly in mktime (eg month set to 13).

Day overflow for less than one month's days is supported.

- 28 Jan 2003 0.04

Gregorian correction handled. In PHP5, we might throw an error if 
mktime uses invalid dates around 5-14 Oct 1582. Released with ADOdb 3.10.
Added limbo 5-14 Oct 1582 check, when we set to 15 Oct 1582.

- 27 Jan 2003 0.03

Fixed some more month problems due to gmt issues. Added constant ADODB_DATE_VERSION.
Fixed calculation of days since start of year for <1970. 

- 27 Jan 2003 0.02

Changed _adodb_getdate() to inline leap year checking for better performance.
Fixed problem with time-zones west of GMT +0000.

- 24 Jan 2003 0.01

First implementation.
*/


/* Initialization */

/*
	Version Number
*/
define('ADODB_DATE_VERSION',0.08);

/*
	We check for Windows as only +ve ints are accepted as dates on Windows.
	
	Apparently this problem happens also with Linux, RH 7.3 and later!
	
	glibc-2.2.5-34 and greater has been changed to return -1 for dates <
	1970.  This used to work.  The problem exists with RedHat 7.3 and 8.0
	echo (mktime(0, 0, 0, 1, 1, 1960));  // prints -1
	
	References:
	 http://bugs.php.net/bug.php?id=20048&edit=2
	 http://lists.debian.org/debian-glibc/2002/debian-glibc-200205/msg00010.html
*/

if (!defined('ADODB_ALLOW_NEGATIVE_TS')) define('ADODB_NO_NEGATIVE_TS',1);

function adodb_date_test_date($y1,$m)
{
	//print " $y1/$m ";
	$t = adodb_mktime(0,0,0,$m,13,$y1);
	if ("$y1-$m-13 00:00:00" != adodb_date('Y-n-d H:i:s',$t)) {
		print "<b>$y1 error</b><br>";
		return false;
	}
	return true;
}
/**
	 Test Suite
*/
function adodb_date_test()
{
	
	error_reporting(E_ALL);
	print "<h4>Testing adodb_date and adodb_mktime. version=".ADODB_DATE_VERSION. "</h4>";
	set_time_limit(0);
	$fail = false;
	
	// This flag disables calling of PHP native functions, so we can properly test the code
	if (!defined('ADODB_TEST_DATES')) define('ADODB_TEST_DATES',1);
	
	print "<p>Testing gregorian <=> julian conversion<p>";
	$t = adodb_mktime(0,0,0,10,11,1492);
	//http://www.holidayorigins.com/html/columbus_day.html - Friday check
	if (!(adodb_date('D Y-m-d',$t) == 'Fri 1492-10-11')) print 'Error in Columbus landing<br>';
	
	$t = adodb_mktime(0,0,0,2,29,1500);
	if (!(adodb_date('Y-m-d',$t) == '1500-02-29')) print 'Error in julian leap years<br>';
	
	$t = adodb_mktime(0,0,0,2,29,1700);
	if (!(adodb_date('Y-m-d',$t) == '1700-03-01')) print 'Error in gregorian leap years<br>';
	
	print  adodb_mktime(0,0,0,10,4,1582).' ';
	print adodb_mktime(0,0,0,10,15,1582);
	$diff = (adodb_mktime(0,0,0,10,15,1582) - adodb_mktime(0,0,0,10,4,1582));
	if ($diff != 3600*24) print " <b>Error in gregorian correction = ".($diff/3600/24)." days </b><br>";
		
	print " 15 Oct 1582, Fri=".(adodb_dow(1582,10,15) == 5 ? 'Fri' : '<b>Error</b>')."<br>";
	print " 4 Oct 1582, Thu=".(adodb_dow(1582,10,4) == 4 ? 'Thu' : '<b>Error</b>')."<br>";
	
	print "<p>Testing overflow<p>";
	
	$t = adodb_mktime(0,0,0,3,33,1965);
	if (!(adodb_date('Y-m-d',$t) == '1965-04-02')) print 'Error in day overflow 1 <br>';
	$t = adodb_mktime(0,0,0,4,33,1971);
	if (!(adodb_date('Y-m-d',$t) == '1971-05-03')) print 'Error in day overflow 2 <br>';
	$t = adodb_mktime(0,0,0,1,60,1965);
	if (!(adodb_date('Y-m-d',$t) == '1965-03-01')) print 'Error in day overflow 3 '.adodb_date('Y-m-d',$t).' <br>';
	$t = adodb_mktime(0,0,0,12,32,1965);
	if (!(adodb_date('Y-m-d',$t) == '1966-01-01')) print 'Error in day overflow 4 '.adodb_date('Y-m-d',$t).' <br>';
	$t = adodb_mktime(0,0,0,12,63,1965);
	if (!(adodb_date('Y-m-d',$t) == '1966-02-01')) print 'Error in day overflow 5 '.adodb_date('Y-m-d',$t).' <br>';
	$t = adodb_mktime(0,0,0,13,3,1965);
	if (!(adodb_date('Y-m-d',$t) == '1966-01-03')) print 'Error in mth overflow 1 <br>';
	
	print "Testing 2-digit => 4-digit year conversion<p>";
	if (adodb_year_digit_check(00) != 2000) print "Err 2-digit 2000<br>";
	if (adodb_year_digit_check(10) != 2010) print "Err 2-digit 2010<br>";
	if (adodb_year_digit_check(20) != 2020) print "Err 2-digit 2020<br>";
	if (adodb_year_digit_check(30) != 2030) print "Err 2-digit 2030<br>";
	if (adodb_year_digit_check(40) != 1940) print "Err 2-digit 1940<br>";
	if (adodb_year_digit_check(50) != 1950) print "Err 2-digit 1950<br>";
	if (adodb_year_digit_check(90) != 1990) print "Err 2-digit 1990<br>";
	
	// Test string formating
	print "<p>Testing date formating</p>";
	$fmt = '\d\a\t\e T Y-m-d H:i:s a A d D F g G h H i j l L m M n O \R\F\C822 r s t U w y Y z Z 2003';
	$s1 = date($fmt,0);
	$s2 = adodb_date($fmt,0);
	if ($s1 != $s2) {
		print " date() 0 failed<br>$s1<br>$s2<br>";
	}
	flush();
	for ($i=100; --$i > 0; ) {

		$ts = 3600.0*((rand()%60000)+(rand()%60000))+(rand()%60000);
		$s1 = date($fmt,$ts);
		$s2 = adodb_date($fmt,$ts);
		//print "$s1 <br>$s2 <p>";
		$pos = strcmp($s1,$s2);

		if (($s1) != ($s2)) {
			for ($j=0,$k=strlen($s1); $j < $k; $j++) {
				if ($s1[$j] != $s2[$j]) {
					print substr($s1,$j).' ';
					break;
				}
			}
			print "<b>Error date(): $ts<br><pre> 
&nbsp; \"$s1\" (date len=".strlen($s1).")
&nbsp; \"$s2\" (adodb_date len=".strlen($s2).")</b></pre><br>";
			$fail = true;
		}
		
		$a1 = getdate($ts);
		$a2 = adodb_getdate($ts);
		$rez = array_diff($a1,$a2);
		if (sizeof($rez)>0) {
			print "<b>Error getdate() $ts</b><br>";
				print_r($a1);
			print "<br>";
				print_r($a2);
			print "<p>";
			$fail = true;
		}
	}
	
	// Test generation of dates outside 1901-2038
	print "<p>Testing random dates between 100 and 4000</p>";
	adodb_date_test_date(100,1);
	for ($i=100; --$i >= 0;) {
		$y1 = 100+rand(0,1970-100);
		$m = rand(1,12);
		adodb_date_test_date($y1,$m);
		
		$y1 = 3000-rand(0,3000-1970);
		adodb_date_test_date($y1,$m);
	}
	print '<p>';
	$start = 1960+rand(0,10);
	$yrs = 12;
	$i = 365.25*86400*($start-1970);
	$offset = 36000+rand(10000,60000);
	$max = 365*$yrs*86400;
	$lastyear = 0;
	
	// we generate a timestamp, convert it to a date, and convert it back to a timestamp
	// and check if the roundtrip broke the original timestamp value.
	print "Testing $start to ".($start+$yrs).", or $max seconds, offset=$offset: ";
	
	for ($max += $i; $i < $max; $i += $offset) {
		$ret = adodb_date('m,d,Y,H,i,s',$i);
		$arr = explode(',',$ret);
		if ($lastyear != $arr[2]) {
			$lastyear = $arr[2];
			print " $lastyear ";
			flush();
		}
		$newi = adodb_mktime($arr[3],$arr[4],$arr[5],$arr[0],$arr[1],$arr[2]);
		if ($i != $newi) {
			print "Error at $i, adodb_mktime returned $newi ($ret)";
			$fail = true;
			break;
		}
	}
	
	if (!$fail) print "<p>Passed !</p>";
	else print "<p><b>Failed</b> :-(</p>";
}

/**
	Returns day of week, 0 = Sunday,... 6=Saturday. 
	Algorithm from PEAR::Date_Calc
*/
function adodb_dow($year, $month, $day)
{
/*
Pope Gregory removed 10 days - October 5 to October 14 - from the year 1582 and 
proclaimed that from that time onwards 3 days would be dropped from the calendar 
every 400 years.

Thursday, October 4, 1582 (Julian) was followed immediately by Friday, October 15, 1582 (Gregorian). 
*/
	if ($year <= 1582) {
		if ($year < 1582 || 
			($year == 1582 && ($month < 10 || ($month == 10 && $day < 15)))) $greg_correction = 3;
		 else
			$greg_correction = 0;
	} else
		$greg_correction = 0;
	
	if($month > 2)
	    $month -= 2;
	else {
	    $month += 10;
	    $year--;
	}
	
	$day =  ( floor((13 * $month - 1) / 5) +
	        $day + ($year % 100) +
	        floor(($year % 100) / 4) +
	        floor(($year / 100) / 4) - 2 *
	        floor($year / 100) + 77);
	
	return (($day - 7 * floor($day / 7))) + $greg_correction;
}


/**
 Checks for leap year, returns true if it is. No 2-digit year check. Also 
 handles julian calendar correctly.
*/
function _adodb_is_leap_year($year) 
{
	if ($year % 4 != 0) return false;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一个色在线综合| 亚洲少妇中出一区| 亚洲人成伊人成综合网小说| 亚洲国产一区二区三区| 久久99国产精品尤物| 色综合久久久网| 久久午夜电影网| 天堂va蜜桃一区二区三区 | 欧美精品一区二区久久婷婷| 国产精品人人做人人爽人人添| 亚洲成人精品影院| 99国内精品久久| 日韩欧美色电影| 亚洲va天堂va国产va久| 91免费在线播放| 日本一区二区久久| 激情欧美一区二区| 9191成人精品久久| 亚洲午夜在线视频| 在线观看视频一区二区| 亚洲人成精品久久久久| 成人精品gif动图一区| 精品sm在线观看| 免费观看在线色综合| 91麻豆精品91久久久久同性| 亚洲第一搞黄网站| 91精品国产欧美日韩| 亚洲精品国产a| 成人美女在线视频| 国产喂奶挤奶一区二区三区| 激情小说亚洲一区| 精品国产免费久久| 日本欧洲一区二区| 日韩一级片网址| 免费观看91视频大全| 51久久夜色精品国产麻豆| 五月天一区二区三区| 一本一道久久a久久精品综合蜜臀| 国产欧美综合在线观看第十页| 国产成人免费在线观看不卡| 国产日韩欧美制服另类| 成人av午夜影院| 亚洲人成精品久久久久| 在线看日韩精品电影| 亚洲va国产天堂va久久en| 欧美一区二区三区在线视频| 老司机一区二区| 久久影院午夜片一区| 国产**成人网毛片九色| 亚洲男同1069视频| 欧美日本一区二区三区四区| 日本成人在线一区| 国产欧美一区二区精品久导航| 成人视屏免费看| 亚洲黄色尤物视频| 欧美成人综合网站| 成人亚洲一区二区一| 成人欧美一区二区三区小说| 欧美日韩激情在线| 国产一区二区精品在线观看| 亚洲色图制服诱惑| 欧美一区二区精品久久911| 国产69精品一区二区亚洲孕妇 | 91在线观看下载| 亚洲h在线观看| 久久久亚洲精品一区二区三区| www.亚洲精品| 午夜精品久久久久久久久久| 久久午夜老司机| 在线观看网站黄不卡| 国产一区欧美二区| 亚洲欧美激情视频在线观看一区二区三区 | 成人av电影在线播放| 午夜久久久影院| 久久精品一区二区三区不卡牛牛| 91色在线porny| 日本伊人色综合网| 国产精品美女久久久久久久久久久| 色香蕉成人二区免费| 日韩电影在线免费| 1000部国产精品成人观看| 91麻豆精品91久久久久同性| 99精品1区2区| 国产精品一区二区视频| 日本不卡一区二区三区高清视频| 中文字幕精品三区| 欧美高清在线一区二区| 精品视频在线免费| 99久久久无码国产精品| 青青青伊人色综合久久| 亚洲精品v日韩精品| 国产网站一区二区| 日韩欧美国产一区二区三区| 91久久精品日日躁夜夜躁欧美| 国产精品自拍一区| 免费不卡在线观看| 亚洲国产精品嫩草影院| 中文字幕一区二区不卡| 欧美国产一区二区| 精品久久久久久综合日本欧美| 欧美日韩小视频| 欧美综合色免费| 色素色在线综合| av电影天堂一区二区在线观看| 国产麻豆视频一区二区| 久久精品国产久精国产| 日本aⅴ免费视频一区二区三区| 亚洲男人的天堂一区二区| 国产精品动漫网站| 国产精品三级在线观看| 中文字幕欧美区| 国产精品入口麻豆原神| 欧美国产日本视频| 中文字幕的久久| 国产精品美女久久久久av爽李琼| 337p日本欧洲亚洲大胆精品| 精品少妇一区二区三区在线播放| 欧美一区二区性放荡片| 欧美一区二区美女| 久久亚洲精华国产精华液 | 国产日韩精品一区二区三区在线| 久久久精品综合| 国产欧美日韩一区二区三区在线观看| 久久色在线视频| 国产欧美日产一区| 成人欧美一区二区三区黑人麻豆 | 9人人澡人人爽人人精品| 99久久99久久精品免费看蜜桃| 99精品偷自拍| 色94色欧美sute亚洲线路一ni| 欧洲精品在线观看| 欧美裸体bbwbbwbbw| 宅男在线国产精品| 精品对白一区国产伦| 久久久久久电影| 亚洲欧洲日产国产综合网| 亚洲自拍偷拍图区| 美国精品在线观看| 成人美女视频在线观看| 一本到高清视频免费精品| 欧美精品一卡二卡| 欧美本精品男人aⅴ天堂| 国产婷婷色一区二区三区在线| 日韩一区中文字幕| 日本中文在线一区| 成人午夜电影网站| 欧美日韩国产另类不卡| 精品国产髙清在线看国产毛片| 国产精品天干天干在线综合| 亚洲一区二区美女| 狠狠色丁香久久婷婷综合丁香| av毛片久久久久**hd| 欧美一区二区三区视频免费播放| 久久久99久久精品欧美| 亚洲男人的天堂在线aⅴ视频| 蜜桃在线一区二区三区| 成人一区二区在线观看| 欧美色涩在线第一页| 国产日韩av一区| 午夜精品久久久久久久| 粉嫩欧美一区二区三区高清影视| 亚洲成人综合视频| 欧美无乱码久久久免费午夜一区 | 成人综合婷婷国产精品久久蜜臀 | 一区二区三区四区在线免费观看| 日本女优在线视频一区二区| 粉嫩aⅴ一区二区三区四区五区 | 国产成人一区二区精品非洲| 色成人在线视频| 久久久综合视频| 午夜精品久久久| voyeur盗摄精品| 久久一夜天堂av一区二区三区| 亚洲综合区在线| av一区二区不卡| 久久精品一区八戒影视| 美女免费视频一区| 欧美丰满一区二区免费视频| 国产精品久久久久久久蜜臀| 激情综合网av| 欧美变态tickling挠脚心| 五月天婷婷综合| 色综合天天综合在线视频| 国产精品久久久久久久久免费丝袜| 蜜桃视频在线观看一区二区| 欧美日本在线视频| 亚洲影视在线播放| 在线欧美日韩精品| 亚洲另类春色校园小说| 一本大道久久a久久综合婷婷| 国产精品婷婷午夜在线观看| 国产成人在线视频网站| 久久九九99视频| 国产精品中文字幕一区二区三区| 日韩精品自拍偷拍| 麻豆国产一区二区| 日韩欧美国产精品| 另类综合日韩欧美亚洲| 欧美精品一二三| 免费人成网站在线观看欧美高清|