本文整理汇总了PHP中adodb_dow函数的典型用法代码示例。如果您正苦于以下问题:PHP adodb_dow函数的具体用法?PHP adodb_dow怎么用?PHP adodb_dow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了adodb_dow函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adodb_date
/**
Return formatted date based on timestamp $d
*/
function adodb_date($fmt, $d = false, $is_gmt = false)
{
static $daylight;
global $ADODB_DATETIME_CLASS;
if ($d === false) {
return $is_gmt ? @gmdate($fmt) : @date($fmt);
}
if (!defined('ADODB_TEST_DATES')) {
if (abs($d) <= 0x7fffffff) {
// check if number in 32-bit signed range
if (!defined('ADODB_NO_NEGATIVE_TS') || $d >= 0) {
// if windows, must be +ve integer
return $is_gmt ? @gmdate($fmt, $d) : @date($fmt, $d);
}
}
}
$_day_power = 86400;
$arr = _adodb_getdate($d, true, $is_gmt);
if (!isset($daylight)) {
$daylight = function_exists('adodb_daylight_sv');
}
if ($daylight) {
adodb_daylight_sv($arr, $is_gmt);
}
$year = $arr['year'];
$month = $arr['mon'];
$day = $arr['mday'];
$hour = $arr['hours'];
$min = $arr['minutes'];
$secs = $arr['seconds'];
$max = strlen($fmt);
$dates = '';
$isphp5 = PHP_VERSION >= 5;
/*
at this point, we have the following integer vars to manipulate:
$year, $month, $day, $hour, $min, $secs
*/
for ($i = 0; $i < $max; $i++) {
switch ($fmt[$i]) {
case 'T':
if ($ADODB_DATETIME_CLASS) {
$dt = new DateTime();
$dt->SetDate($year, $month, $day);
$dates .= $dt->Format('T');
} else {
$dates .= date('T');
}
break;
// YEAR
// YEAR
case 'L':
$dates .= $arr['leap'] ? '1' : '0';
break;
case 'r':
// Thu, 21 Dec 2000 16:01:07 +0200
// 4.3.11 uses '04 Jun 2004'
// 4.3.8 uses ' 4 Jun 2004'
$dates .= gmdate('D', $_day_power * (3 + adodb_dow($year, $month, $day))) . ', ' . ($day < 10 ? '0' . $day : $day) . ' ' . date('M', mktime(0, 0, 0, $month, 2, 1971)) . ' ' . $year . ' ';
if ($hour < 10) {
$dates .= '0' . $hour;
} else {
$dates .= $hour;
}
if ($min < 10) {
$dates .= ':0' . $min;
} else {
$dates .= ':' . $min;
}
if ($secs < 10) {
$dates .= ':0' . $secs;
} else {
$dates .= ':' . $secs;
}
$gmt = adodb_get_gmt_diff($year, $month, $day);
$dates .= ' ' . adodb_tz_offset($gmt, $isphp5);
break;
case 'Y':
$dates .= $year;
break;
case 'y':
$dates .= substr($year, strlen($year) - 2, 2);
break;
// MONTH
// MONTH
case 'm':
if ($month < 10) {
$dates .= '0' . $month;
} else {
$dates .= $month;
}
break;
case 'Q':
$dates .= $month + 3 >> 2;
break;
case 'n':
$dates .= $month;
break;
//.........这里部分代码省略.........
示例2: adodb_date
/**
Return formatted date based on timestamp $d
*/
function adodb_date($fmt, $d = false, $is_gmt = false)
{
if ($d === false) {
return date($fmt);
}
if (!defined('ADODB_TEST_DATES')) {
if (abs($d) <= 0x7fffffff) {
// check if number in 32-bit signed range
if (!defined('ADODB_NO_NEGATIVE_TS') || $d >= 0) {
// if windows, must be +ve integer
return @date($fmt, $d);
}
}
}
$_day_power = 86400;
$arr = _adodb_getdate($d, true, $is_gmt);
$year = $arr['year'];
$month = $arr['mon'];
$day = $arr['mday'];
$hour = $arr['hours'];
$min = $arr['minutes'];
$secs = $arr['seconds'];
$max = strlen($fmt);
$dates = '';
/*
at this point, we have the following integer vars to manipulate:
$year, $month, $day, $hour, $min, $secs
*/
for ($i = 0; $i < $max; $i++) {
switch ($fmt[$i]) {
case 'T':
$dates .= date('T');
break;
// YEAR
// YEAR
case 'L':
$dates .= $arr['leap'] ? '1' : '0';
break;
case 'r':
// Thu, 21 Dec 2000 16:01:07 +0200
$dates .= gmdate('D', $_day_power * (3 + adodb_dow($year, $month, $day))) . ', ' . ($day < 10 ? ' ' . $day : $day) . ' ' . date('M', mktime(0, 0, 0, $month, 2, 1971)) . ' ' . $year . ' ';
if ($hour < 10) {
$dates .= '0' . $hour;
} else {
$dates .= $hour;
}
if ($min < 10) {
$dates .= ':0' . $min;
} else {
$dates .= ':' . $min;
}
if ($secs < 10) {
$dates .= ':0' . $secs;
} else {
$dates .= ':' . $secs;
}
$gmt = adodb_get_gmt_different();
$dates .= sprintf(' %s%04d', $gmt < 0 ? '+' : '-', abs($gmt) / 36);
break;
case 'Y':
$dates .= $year;
break;
case 'y':
$dates .= substr($year, strlen($year) - 2, 2);
break;
// MONTH
// MONTH
case 'm':
if ($month < 10) {
$dates .= '0' . $month;
} else {
$dates .= $month;
}
break;
case 'n':
$dates .= $month;
break;
case 'M':
$dates .= date('M', mktime(0, 0, 0, $month, 2, 1971));
break;
case 'F':
$dates .= date('F', mktime(0, 0, 0, $month, 2, 1971));
break;
// DAY
// DAY
case 't':
$dates .= $arr['ndays'];
break;
case 'z':
$dates .= $arr['yday'];
break;
case 'w':
$dates .= adodb_dow($year, $month, $day);
break;
case 'l':
$dates .= gmdate('l', $_day_power * (3 + adodb_dow($year, $month, $day)));
break;
//.........这里部分代码省略.........