当前位置: 首页>>代码示例>>PHP>>正文


PHP adodb_date函数代码示例

本文整理汇总了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')";
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:7,代码来源:adodb-oracle.inc.php

示例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')";
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:8,代码来源:adodb-oracle.inc.php

示例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;
 }
开发者ID:javierdlahoz,项目名称:paella-development,代码行数:36,代码来源:class.date.php

示例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);
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:18,代码来源:adodb-time.inc.php

示例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;
}
开发者ID:nhainam,项目名称:wordpress4,代码行数:55,代码来源:functions.php

示例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;
 }
开发者ID:centaurustech,项目名称:BenFund,代码行数:95,代码来源:adodb-ado5.inc.php

示例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')";
 }
开发者ID:elie89,项目名称:moodle,代码行数:10,代码来源:adodb-db2.inc.php

示例8: FormatDate

 function FormatDate($format, $date)
 {
     if ($this->UseAdodbTime) {
         return adodb_date($format, $date);
     } else {
         return date($format, $date);
     }
 }
开发者ID:Ombogo,项目名称:new_api_chat,代码行数:8,代码来源:ganttfn.php

示例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;
 }
开发者ID:antiwise,项目名称:collect,代码行数:94,代码来源:adodb-ado.inc.php

示例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;
 }
开发者ID:aarongillett,项目名称:B22-151217,代码行数:18,代码来源:bootstrap.php

示例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')";
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:10,代码来源:adodb-oci8.inc.php

示例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);
 }
开发者ID:jin255ff,项目名称:company_website,代码行数:12,代码来源:adodb-db2.inc.php

示例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;
}
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:48,代码来源:date.php

示例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;
 }
开发者ID:rebeccayshen,项目名称:kitlist,代码行数:35,代码来源:CredPostExpiration.php

示例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;
 }
开发者ID:sintattica,项目名称:atk,代码行数:45,代码来源:Tools.php


注:本文中的adodb_date函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。