本文整理汇总了PHP中adodb_gmdate函数的典型用法代码示例。如果您正苦于以下问题:PHP adodb_gmdate函数的具体用法?PHP adodb_gmdate怎么用?PHP adodb_gmdate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了adodb_gmdate函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UserTimeStamp
/**
*
* @param v is the character timestamp in YYYY-MM-DD hh:mm:ss format
* @param fmt is the format to apply to it, using date()
*
* @return a timestamp formated as user desires
*/
function UserTimeStamp($v, $fmt = 'Y-m-d H:i:s', $gmt = false)
{
if (!isset($v)) {
return $this->emptyTimeStamp;
}
# strlen(14) allows YYYYMMDDHHMMSS format
if (is_numeric($v) && strlen($v) < 14) {
return $gmt ? adodb_gmdate($fmt, $v) : adodb_date($fmt, $v);
}
$tt = $this->UnixTimeStamp($v);
// $tt == -1 if pre TIMESTAMP_FIRST_YEAR
if (($tt === false || $tt == -1) && $v != false) {
return $v;
}
if ($tt == 0) {
return $this->emptyTimeStamp;
}
return $gmt ? adodb_gmdate($fmt, $tt) : adodb_date($fmt, $tt);
}
示例2: mkActiveGMDate
function mkActiveGMDate($param, $acttime = false)
{
if (!$acttime) {
$acttime = time();
}
if (function_exists("adodb_gmdate")) {
return adodb_gmdate($param, $acttime);
} else {
return gmdate($param, $acttime);
}
}
示例3: wpcf_fields_date_get_calendar
/**
* Calendar view.
*
* @global object $wpdb
* @global type $m
* @global type $wp_locale
* @global type $actors
* @param type $params
* @param type $initial
* @param type $echo
* @return type
*/
function wpcf_fields_date_get_calendar($params, $initial = true, $echo = true)
{
global $wpdb, $m, $wp_locale, $actors;
// wpcf Set our own date
$monthnum = adodb_date('n', $params['field_value']);
$year = adodb_date('Y', $params['field_value']);
$wpcf_date = adodb_date('j', $params['field_value']);
$cache = array();
$key = md5($params['field']['slug'] . $wpcf_date);
if ($cache = wp_cache_get('get_calendar', 'calendar')) {
if (is_array($cache) && isset($cache[$key])) {
if ($echo) {
echo apply_filters('get_calendar', $cache[$key]);
return;
} else {
return apply_filters('get_calendar', $cache[$key]);
}
}
}
if (!is_array($cache)) {
$cache = array();
}
if (isset($_GET['w'])) {
$w = '' . intval($_GET['w']);
}
// week_begins = 0 stands for Sunday
$week_begins = intval(get_option('start_of_week'));
// Let's figure out when we are
if (!empty($monthnum) && !empty($year)) {
$thismonth = '' . zeroise(intval($monthnum), 2);
$thisyear = '' . intval($year);
} elseif (!empty($w)) {
// We need to get the month from MySQL
$thisyear = '' . intval(substr($m, 0, 4));
$d = ($w - 1) * 7 + 6;
//it seems MySQL's weeks disagree with PHP's
$thismonth = $wpdb->get_var($wpdb->prepare("SELECT DATE_FORMAT((DATE_ADD(%s, INTERVAL %d DAY) ), '%%m')", sprintf('%d0101', $thisyear), $d));
} elseif (!empty($m)) {
$thisyear = '' . intval(substr($m, 0, 4));
if (strlen($m) < 6) {
$thismonth = '01';
} else {
$thismonth = '' . zeroise(intval(substr($m, 4, 2)), 2);
}
} else {
$thisyear = adodb_gmdate('Y', current_time('timestamp'));
$thismonth = adodb_gmdate('m', current_time('timestamp'));
}
$unixmonth = adodb_mktime(0, 0, 0, $thismonth, 1, $thisyear);
$last_day = adodb_date('t', $unixmonth);
$class = !empty($params['class']) ? ' class="' . $params['class'] . '"' : '';
/* translators: Calendar caption: 1: month name, 2: 4-digit year */
$calendar_caption = _x('%1$s %2$s', 'calendar caption');
$calendar_output = '<table id="wp-calendar-' . md5(serialize(func_get_args())) . '" summary="' . esc_attr__('Calendar') . '"' . $class . '>
<caption>' . sprintf($calendar_caption, $wp_locale->get_month($thismonth), adodb_date('Y', $unixmonth)) . '</caption>
<thead>
<tr>';
$myweek = array();
for ($wdcount = 0; $wdcount <= 6; $wdcount++) {
$myweek[] = $wp_locale->get_weekday(($wdcount + $week_begins) % 7);
}
foreach ($myweek as $wd) {
$day_name = true == $initial ? $wp_locale->get_weekday_initial($wd) : $wp_locale->get_weekday_abbrev($wd);
$wd = esc_attr($wd);
$calendar_output .= "\n\t\t<th scope=\"col\" title=\"{$wd}\">{$day_name}</th>";
}
$calendar_output .= '
</tr>
</thead>
<tfoot>
<tr>';
$calendar_output .= '
</tr>
</tfoot>
<tbody>
<tr>';
// See how much we should pad in the beginning
$pad = calendar_week_mod(adodb_date('w', $unixmonth) - $week_begins);
if (0 != $pad) {
$calendar_output .= "\n\t\t" . '<td colspan="' . esc_attr($pad) . '" class="pad"> </td>';
}
$daysinmonth = intval(adodb_date('t', $unixmonth));
for ($day = 1; $day <= $daysinmonth; ++$day) {
if (isset($newrow) && $newrow) {
$calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t";
}
//.........这里部分代码省略.........
示例4: wpcf_conditional_add_date_controls
/**
* Date select form for Group edit screen.
*
* @global type $wp_locale
* @param type $function
* @param type $value
* @param type $name
* @return string
*
*/
function wpcf_conditional_add_date_controls($function, $value, $name)
{
global $wp_locale;
if ($function == 'date') {
$date_parts = explode(',', $value);
$time_adj = adodb_mktime(0, 0, 0, $date_parts[1], $date_parts[0], $date_parts[2]);
} else {
$time_adj = current_time('timestamp');
}
$jj = adodb_gmdate('d', $time_adj);
$mm = adodb_gmdate('m', $time_adj);
$aa = adodb_gmdate('Y', $time_adj);
$output = '<div class="wpcf-custom-field-date">' . "\n";
$month = "<select name=\"" . $name . '[month]' . "\" >\n";
for ($i = 1; $i < 13; $i = $i + 1) {
$monthnum = zeroise($i, 2);
$month .= "\t\t\t" . '<option value="' . $monthnum . '"';
if ($i == $mm) {
$month .= ' selected="selected"';
}
$month .= '>' . $monthnum . '-' . $wp_locale->get_month_abbrev($wp_locale->get_month($i)) . "</option>\n";
}
$month .= '</select>';
$day = '<input name="' . $name . '[date]" type="text" value="' . $jj . '" size="2" maxlength="2" autocomplete="off" />';
$year = '<input name="' . $name . '[year]" type="text" value="' . $aa . '" size="4" maxlength="4" autocomplete="off" />';
$output .= sprintf(__('%1$s%2$s, %3$s'), $month, $day, $year);
$output .= '<div class="wpcf_custom_field_invalid_date wpcf-form-error"><p>' . __('Please enter a valid date here', 'wpcf') . '</p></div>' . "\n";
$output .= "</div>\n";
return $output;
}
示例5: carl_gmdate
/**
* Alias for adodb_gmdate()
*/
function carl_gmdate($format, $timestamp = false)
{
return adodb_gmdate($format, $timestamp);
}