本文整理汇总了PHP中adodb_date函数的典型用法代码示例。如果您正苦于以下问题:PHP adodb_date函数的具体用法?PHP adodb_date怎么用?PHP adodb_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了adodb_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DBTimeStamp
function DBTimeStamp($ts)
{
if (is_string($ts)) {
$d = ADORecordSet::UnixTimeStamp($ts);
}
return 'TO_DATE(' . adodb_date($this->fmtTimeStamp, $ts) . ",'RRRR-MM-DD, HH:MI:SS AM')";
}
示例2: DBTimeStamp
function DBTimeStamp($ts)
{
if (is_string($ts)) $ts = ADORecordSet::UnixTimeStamp($ts);
if (is_object($ts)) $ds = $ts->format($this->fmtDate);
else $ds = adodb_date($this->fmtTimeStamp,$ts);
return 'TO_DATE('.$ds.",'RRRR-MM-DD, HH:MI:SS AM')";
}
示例3: metaform
public function metaform()
{
$timestamp = $this->getValue();
if (!is_numeric($timestamp)) {
$timestamp = self::strtotime($timestamp);
}
if (!empty($timestamp)) {
$datepicker = adodb_date(self::getDateFormat(), $timestamp);
$hour = adodb_date('H', $timestamp);
$minute = adodb_date('i', $timestamp);
} else {
$datepicker = $hour = $minute = null;
}
$data = $this->getData();
$form = array();
$form[] = array('#type' => 'textfield', '#title' => $this->getTitle(), '#attributes' => array('class' => 'js-wpt-date', 'style' => 'width:150px;'), '#name' => $this->getName() . '[datepicker]', '#value' => $datepicker, '#validate' => $this->getValidationData());
if (!empty($data['add_time'])) {
// Hour
$hours = 24;
$options = array();
for ($index = 0; $index < $hours; $index++) {
$prefix = $index < 10 ? '0' : '';
$options[$index] = array('#title' => $prefix . strval($index), '#value' => $index);
}
$form[] = array('#type' => 'select', '#title' => __('Hour'), '#options' => $options, '#default_value' => $hour, '#name' => $this->getName() . '[hour]', '#inline' => true);
// Minutes
$minutes = 60;
$options = array();
for ($index = 0; $index < $minutes; $index++) {
$prefix = $index < 10 ? '0' : '';
$options[$index] = array('#title' => $prefix . strval($index), '#value' => $index);
}
$form[] = array('#type' => 'select', '#title' => __('Minute'), '#options' => $options, '#default_value' => $minute, '#name' => $this->getName() . '[minute]', '#inline' => true);
}
return $form;
}
示例4: adodb_date2
function adodb_date2($fmt, $d = false, $is_gmt = false)
{
if ($d !== false) {
if (!preg_match("|^([0-9]{4})[-/\\.]?([0-9]{1,2})[-/\\.]?([0-9]{1,2})[ -]?(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\\.]{1,4}))?|", $d, $rr)) {
return adodb_date($fmt, false, $is_gmt);
}
if ($rr[1] <= 100 && $rr[2] <= 1) {
return adodb_date($fmt, false, $is_gmt);
}
// h-m-s-MM-DD-YY
if (!isset($rr[5])) {
$d = adodb_mktime(0, 0, 0, $rr[2], $rr[3], $rr[1]);
} else {
$d = @adodb_mktime($rr[5], $rr[6], $rr[7], $rr[2], $rr[3], $rr[1]);
}
}
return adodb_date($fmt, $d, $is_gmt);
}
示例5: __wpcf_fields_date_check_leftover
/**
* Fix due to a bug saving date as array.
*
* BUGS
* 'timestamp' is saved without Hour and Minute appended.
*
* @param type $value
* @param type $field
*/
function __wpcf_fields_date_check_leftover($value, $field, $use_cache = true)
{
if (empty($value)) {
return $value;
}
if (!is_object($field)) {
$post_id = wpcf_get_post_id();
$field_id = isset($field['id']) ? $field['id'] : false;
$meta_id = isset($field['__meta_id']) ? $field['__meta_id'] : false;
} else {
$post_id = isset($field->meta_object->post_id) ? $field->meta_object->post_id : false;
$field_id = isset($field->cf['id']) ? $field->cf['id'] : false;
$meta_id = isset($field->meta_object->meta_id) ? $field->meta_object->meta_id : false;
}
if (empty($post_id) || empty($meta_id) || empty($field_id)) {
return $value;
}
$field_slug = wpcf_types_get_meta_prefix() . $field_id;
// Check if cached
static $cache = array();
$cache_key = $meta_id;
if (isset($cache[$cache_key]) && $use_cache) {
return $cache[$cache_key];
}
$_meta = wpcf_get_post_meta($post_id, '_wpcf_' . $field_id . '_hour_and_minute', true);
/*
* If meta exists - it's outdated value
* and Hour and Minute should be appended and removed.
*/
if (!empty($_meta) && is_array($_meta) && isset($_meta[$meta_id])) {
$meta = $_meta[$meta_id];
// Return empty date if can not be calculated
if (!empty($meta['timestamp']) || !empty($meta['datepicker'])) {
$meta['timestamp'] = wpcf_fields_date_value_get_filter($meta, $field, 'timestamp', 'check_leftover');
// Check if calculation needed
if (isset($meta['hour']) && $meta['hour'] != adodb_date('H', $meta['timestamp']) || isset($meta['minute']) && $meta['minute'] != adodb_date('i', $meta['timestamp'])) {
$value = wpcf_fields_date_calculate_time($meta);
}
}
}
// Cache it
if ($use_cache) {
$cache[$cache_key] = $value;
}
return $value;
}
示例6: _fetch
function _fetch()
{
$rs = $this->_queryID;
if (!$rs or $rs->EOF) {
$this->fields = false;
return false;
}
$this->fields = array();
if (!$this->_tarr) {
$tarr = array();
$flds = array();
for ($i = 0, $max = $this->_numOfFields; $i < $max; $i++) {
$f = $rs->Fields($i);
$flds[] = $f;
$tarr[] = $f->Type;
}
// bind types and flds only once
$this->_tarr = $tarr;
$this->_flds = $flds;
}
$t = reset($this->_tarr);
$f = reset($this->_flds);
if ($this->hideErrors) {
$olde = error_reporting(E_ERROR | E_CORE_ERROR);
}
// sometimes $f->value be null
for ($i = 0, $max = $this->_numOfFields; $i < $max; $i++) {
//echo "<p>",$t,' ';var_dump($f->value); echo '</p>';
switch ($t) {
case 135:
// timestamp
if (!strlen((string) $f->value)) {
$this->fields[] = false;
} else {
if (!is_numeric($f->value)) {
$val = variant_date_to_timestamp($f->value);
} else {
$val = $f->value;
}
$this->fields[] = adodb_date('Y-m-d H:i:s', $val);
}
break;
case 133:
// A date value (yyyymmdd)
if ($val = $f->value) {
$this->fields[] = substr($val, 0, 4) . '-' . substr($val, 4, 2) . '-' . substr($val, 6, 2);
} else {
$this->fields[] = false;
}
break;
case 7:
// adDate
if (!strlen((string) $f->value)) {
$this->fields[] = false;
} else {
if (!is_numeric($f->value)) {
$val = variant_date_to_timestamp($f->value);
} else {
$val = $f->value;
}
if ($val % 86400 == 0) {
$this->fields[] = adodb_date('Y-m-d', $val);
} else {
$this->fields[] = adodb_date('Y-m-d H:i:s', $val);
}
}
break;
case 1:
// null
$this->fields[] = false;
break;
case 6:
// currency is not supported properly;
ADOConnection::outp('<b>' . $f->Name . ': currency type not supported by PHP</b>');
$this->fields[] = (double) $f->value;
break;
default:
$this->fields[] = $f->value;
break;
}
//print " $f->value $t, ";
$f = next($this->_flds);
$t = next($this->_tarr);
}
// for
if ($this->hideErrors) {
error_reporting($olde);
}
@$rs->MoveNext();
// @ needed for some versions of PHP!
if ($this->fetchMode & ADODB_FETCH_ASSOC) {
$this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE);
}
return true;
}
示例7: DBTimeStamp
function DBTimeStamp($ts, $isfld = false)
{
if (empty($ts) && $ts !== 0) {
return 'null';
}
if (is_string($ts)) {
$ts = ADORecordSet::UnixTimeStamp($ts);
}
return 'TO_DATE(' . adodb_date($this->fmtTimeStamp, $ts) . ",'YYYY-MM-DD HH24:MI:SS')";
}
示例8: FormatDate
function FormatDate($format, $date)
{
if ($this->UseAdodbTime) {
return adodb_date($format, $date);
} else {
return date($format, $date);
}
}
示例9: _fetch
function _fetch()
{
$rs = $this->_queryID;
if (!$rs or $rs->EOF) {
$this->fields = false;
return false;
}
$this->fields = array();
if (!$this->_tarr) {
$tarr = array();
$flds = array();
$i = 0;
for ($max = $this->_numOfFields; $i < $max; ++$i) {
$f = $rs->Fields($i);
$flds[] = $f;
$tarr[] = $f->Type;
}
$this->_tarr = $tarr;
$this->_flds = $flds;
}
$t = reset($this->_tarr);
$f = reset($this->_flds);
if ($this->hideErrors) {
$olde = error_reporting(E_ERROR | E_CORE_ERROR);
}
$i = 0;
for ($max = $this->_numOfFields; $i < $max; ++$i) {
switch ($t) {
case 135:
if (!strlen((string) $f->value)) {
$this->fields[] = false;
break;
} else {
if (!is_numeric($f->value)) {
$val = variant_date_to_timestamp($f->value);
} else {
$val = $f->value;
}
$this->fields[] = adodb_date('Y-m-d H:i:s', $val);
break;
}
break;
case 133:
if ($val = $f->value) {
$this->fields[] = substr($val, 0, 4) . '-' . substr($val, 4, 2) . '-' . substr($val, 6, 2);
break;
} else {
$this->fields[] = false;
break;
}
break;
case 7:
if (!strlen((string) $f->value)) {
$this->fields[] = false;
break;
} else {
if (!is_numeric($f->value)) {
$val = variant_date_to_timestamp($f->value);
} else {
$val = $f->value;
}
if ($val % 86400 == 0) {
$this->fields[] = adodb_date('Y-m-d', $val);
break;
} else {
$this->fields[] = adodb_date('Y-m-d H:i:s', $val);
break;
}
break;
}
break;
case 1:
$this->fields[] = false;
break;
case 6:
adoconnection::outp('<b>' . $f->Name . ': currency type not supported by PHP</b>');
$this->fields[] = (double) $f->value;
break;
default:
$this->fields[] = $f->value;
break;
}
$f = next($this->_flds);
$t = next($this->_tarr);
}
if ($this->hideErrors) {
error_reporting($olde);
}
@$rs->MoveNext();
if ($this->fetchMode & ADODB_FETCH_ASSOC) {
$this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE);
}
return true;
}
示例10: wpt_localize_extended_date
public function wpt_localize_extended_date()
{
if (!isset($_POST['date'])) {
die;
}
$date = $_POST['date'];
$date_format = '';
if (isset($_POST['date-format'])) {
$date_format = $_POST['date-format'];
}
if ($date_format == '') {
$date_format = get_option('date_format');
}
$date = adodb_mktime(0, 0, 0, substr($date, 2, 2), substr($date, 0, 2), substr($date, 4, 4));
$date_format = str_replace('\\\\', '\\', $date_format);
echo json_encode(array('display' => adodb_date($date_format, $date), 'timestamp' => $date));
die;
}
示例11: DBTimeStamp
function DBTimeStamp($ts)
{
if (empty($ts) && $ts !== 0) {
return 'null';
}
if (is_string($ts)) {
$ts = ADORecordSet::UnixTimeStamp($ts);
}
return 'TO_DATE(' . adodb_date($this->fmtTimeStamp, $ts) . ",'RRRR-MM-DD, HH:MI:SS AM')";
}
示例12: DBTimeStamp
function DBTimeStamp($ts)
{
if (empty($ts) && $ts !== 0) {
return 'null';
}
if (is_string($ts)) {
$ts = ADORecordSet::UnixTimeStamp($ts);
}
// See #8387 for more details
// original: return 'TO_DATE('.adodb_date($this->fmtTimeStamp,$ts).",'YYYY-MM-DD HH24:MI:SS')";
return adodb_date($this->fmtTimeStamp, $ts);
}
示例13: wpcf_fields_date_view
/**
* View function.
*
* @param type $params
*/
function wpcf_fields_date_view($params)
{
global $wp_locale;
$defaults = array('format' => get_option('date_format'), 'style' => '');
$params = wp_parse_args($params, $defaults);
$output = '';
// Make sure value is right
$__timestamp = wpcf_fields_date_value_get_filter($params['field_value'], $params['field'], 'timestamp');
if (is_null($__timestamp)) {
return '';
} else {
$params['field_value'] = $__timestamp;
}
switch ($params['style']) {
case 'calendar':
$output .= wpcf_fields_date_get_calendar($params, true, false);
break;
default:
$field_name = '';
// Extract the Full month and Short month from the format.
// We'll replace with the translated months if possible.
$format = $params['format'];
//$format = str_replace( 'F', '#111111#', $format );
//$format = str_replace( 'M', '#222222#', $format );
// Same for the Days
//$format = str_replace( 'D', '#333333#', $format );
//$format = str_replace( 'l', '#444444#', $format );
$date_out = adodb_date($format, $params['field_value']);
//$month = adodb_date( 'm', $params['field_value'] );
//$month_full = $wp_locale->get_month( $month );
//$date_out = str_replace( '#111111#', $month_full, $date_out );
//$month_short = $wp_locale->get_month_abbrev( $month_full );
//$date_out = str_replace( '#222222#', $month_short, $date_out );
//$day = adodb_date( 'w', $params['field_value'] );
//$day_full = $wp_locale->get_weekday( $day );
//$date_out = str_replace( '#444444#', $day_full, $date_out );
//$day_short = $wp_locale->get_weekday_abbrev( $day_full );
//$date_out = str_replace( '#333333#', $day_short, $date_out );
$output .= $date_out;
break;
}
return $output;
}
示例14: cred_pe_shortcode_cred_post_expiration
/**
* cred-post-expiration-shortcode: cred-post-expiration
*
* Description: Display the expiration date/time of the current post
*
* Parameters:
* id => post ID, defaults to global $post->ID
* format => Format string for the date. Defaults to Wordpress settings option (date_format)
*
* Example usage:
* Expiration on [cred-post-expiration format="F jS, Y"]
*
* Link:
* Format parameter is the same as here: http://codex.wordpress.org/Formatting_Date_and_Time
*
* Note:
*
*/
function cred_pe_shortcode_cred_post_expiration($atts)
{
extract(shortcode_atts(array('id' => '', 'format' => get_option('date_format')), $atts));
$out = '';
$post_id = $id;
global $post;
if (empty($post_id) && isset($post->ID)) {
$post_id = $post->ID;
}
if (!empty($post_id)) {
$post_expiration_time = get_post_meta($post_id, $this->_post_expiration_time_field, true);
if (self::_isTimestampInRange($post_expiration_time)) {
$out = apply_filters('the_time', adodb_date($format, $post_expiration_time));
}
}
return $out;
}
示例15: atkFormatDate
/**
* Format date according to a format string, uses ATK's language files to translate
* months, weekdays etc.
*
* @param $date mixed timestamp or date array (gotten with getdate())
* @param $format string format string, compatible with PHP's date format functions
* @param $weekday bool always include day-of-week or not
*
* @return string formatted date
*/
public static function atkFormatDate($date, $format, $weekday = false)
{
static $langcache = [];
if (!is_array($date)) {
$date = getdate($date);
}
/* format month */
$format = str_replace('M', '%-%', $format);
$format = str_replace('F', '%=%', $format);
/* format day */
$format = str_replace('D', '%&%', $format);
$format = str_replace('l', '%*%', $format);
if ($weekday && strpos($format, '%&%') === false && strpos($format, '%*%') === false) {
$format = str_replace('d', '%*% d', $format);
$format = str_replace('j', '%*% j', $format);
}
/* get date string */
$str_date = adodb_date($format, $date[0]);
$month = $date['month'];
$shortmonth = substr(strtolower($date['month']), 0, 3);
/* store the self::text calls */
if (!isset($langcache[$month])) {
$langcache[$month] = self::atktext(strtolower($month), 'atk');
}
if (!isset($langcache[$shortmonth])) {
$langcache[$shortmonth] = self::atktext($shortmonth);
}
/* replace month/week name */
$str_date = str_replace('%-%', $langcache[$shortmonth], $str_date);
$str_date = str_replace('%=%', $langcache[$month], $str_date);
$str_date = str_replace('%*%', self::atktext(strtolower($date['weekday']), 'atk'), $str_date);
$str_date = str_replace('%&%', self::atktext(substr(strtolower($date['weekday']), 0, 3), 'atk'), $str_date);
/* return string */
return $str_date;
}