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


PHP adodb_mktime函数代码示例

本文整理汇总了PHP中adodb_mktime函数的典型用法代码示例。如果您正苦于以下问题:PHP adodb_mktime函数的具体用法?PHP adodb_mktime怎么用?PHP adodb_mktime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了adodb_mktime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wpcf_fields_date_value_save_filter

/**
 * Converts date to time on post saving.
 * 
 * @param array $value Use 'datepicker' to convert to timestamp.
 * @return int timestamp 
 */
function wpcf_fields_date_value_save_filter($value, $field, $field_object)
{
    if (defined('WPTOOLSET_FORMS_VERSION')) {
        if (empty($value) || empty($value['datepicker'])) {
            return false;
        }
        if (is_numeric($value['datepicker'])) {
            $timestamp = $value['datepicker'];
        } else {
            $timestamp = wptoolset_strtotime($value['datepicker']);
        }
        // Append Hour and Minute
        if ($timestamp !== false && isset($value['hour']) && isset($value['minute'])) {
            $timestamp_date = adodb_date('dmY', $timestamp);
            $date = adodb_mktime(intval($value['hour']), intval($value['minute']), 0, substr($timestamp_date, 2, 2), substr($timestamp_date, 0, 2), substr($timestamp_date, 4, 4));
            $timestamp = $date;
            /*
            $date = new DateTime( $value['datepicker'] );
                        try {
                            $date->add( new DateInterval( 'PT' . intval( $value['hour'] ) . 'H' . intval( $value['minute'] ) . 'M' ) );
                        } catch (Exception $e) {
                            return $timestamp;
                        }
                        $timestamp = $date->format( "U" );
            */
        }
        return $timestamp;
    }
    // I understand this below is not executed anymore?
    global $wpcf;
    // Remove additional meta if any
    if (isset($field_object->post->ID)) {
        delete_post_meta($field_object->post->ID, '_wpcf_' . $field_object->cf['id'] . '_hour_and_minute');
    }
    if (empty($value) || empty($value['datepicker'])) {
        return false;
    }
    $value['timestamp'] = wpcf_fields_date_convert_datepicker_to_timestamp($value['datepicker']);
    if (!wpcf_fields_date_timestamp_is_valid($value['timestamp'])) {
        $wpcf->debug->errors['date_save_failed'][] = array('value' => $value, 'field' => $field);
        return false;
    }
    // Append Hour and Minute
    if (isset($value['hour']) && isset($value['minute'])) {
        $value['timestamp'] = wpcf_fields_date_calculate_time($value);
    }
    return $value['timestamp'];
}
开发者ID:nhainam,项目名称:wordpress4,代码行数:54,代码来源:functions.php

示例2: dateDiff

function dateDiff($fecha1, $fecha2, $type = "D") {
	// $type puede ser D (dias), M (meses) o A (años)..

	// Valido los datos..
	if ((!isFechaValida($fecha1)) or (!isFechaValida($fecha2)))
		return false;

	//Convertimos ambas fechas a su unix timestamp con adodb_mktime..
	$tmp = explode("/", $fecha1);
	$fecha1 = $tmp[1]."/".$tmp[0]."/".$tmp[2];
	$time1 = adodb_mktime(0, 0, 0, $tmp[1], $tmp[0], $tmp[2]);

	$tmp = explode("/", $fecha2);
	$fecha2 = $tmp[1]."/".$tmp[0]."/".$tmp[2];
	$time2 = adodb_mktime(0, 0, 0, $tmp[1], $tmp[0], $tmp[2]);

	$diferencia = $time2 - $time1;
	$result = 0;

	// Ahora ya tengo la cantidad de segundos entre las dos fechas..
	// Dividamoslas entre X para obtener ya sean la fecha en años, meses o dias.

	if ($type == "A") {
		list($mes1, $dia1, $ano1) = explode("/", $fecha1);
		list($mes2, $dia2, $ano2) = explode("/", $fecha2);

		$ano_dif = $ano2 - $ano1;
		$mes_dif = $mes2 - $mes1;
		$dia_dif = $dia2 - $dia1;
		if (($mes_dif < 0) or (($mes_dif == 0) and ($dia_dif < 0)))
			$ano_dif--;
		$result = $ano_dif;
	}

	if ($type == "M") {
		$meses = $diferencia / (60 * 60 * 24 * 30);		// 30 días como promedio por mes..
		$meses = ceil($meses);
		$result = $meses;
	}

	if ($type == "D") {
		$dias = $diferencia / (60 * 60 * 24);
		$dias = ceil($dias);
		$result = $dias;
	}

	return $result;
}
开发者ID:javierlov,项目名称:FuentesWeb,代码行数:48,代码来源:date_utils.php

示例3: getTimestamp

 /**
  * Returns an ADODB Date timestamp
  * @return int
  */
 public function getTimestamp($strtime = '')
 {
     $strtime = $strtime !== '' ? $strtime : $this->_dtstr;
     if (self::$isDateTimeSupported) {
         $dt = new DateTime(is_numeric($strtime) ? "@{$strtime}" : $strtime);
         $v = $dt->format('U');
     } else {
         if (is_numeric($strtime)) {
             return $strtime;
         } else {
             $d = $strtime && $strtime != 'now' ? $this->parse($strtime) : getdate();
             $v = $d ? adodb_mktime($d['hours'], $d['minutes'], $d['seconds'], $d['mon'], $d['mday'], $d['year']) : false;
         }
     }
     return !$v || $v == $strtime ? false : $v;
 }
开发者ID:enriqueism,项目名称:raxan,代码行数:20,代码来源:raxan.datetime.php

示例4: carl_mktime

/**
 * Wrapper for adodb_mktime()
 * Checks if year is zero and returns internal php mktime in that case
 */
function carl_mktime($hr, $min, $sec, $month = false, $day = false, $year = false, $is_dst = false, $is_gmt = false)
{
    $int_year = intval($year);
    if ($int_year == 0) {
        //return mktime($hr,$min,$sec,$month,$day,$year,$is_dst); // $is_dst param is deprecated in php 5
        return mktime((int) $hr, (int) $min, (int) $sec, (int) $month, (int) $day);
    } else {
        if ($int_year < 100) {
            // adodb_mktime seems to have a bug where it returns the time plus 1 hour
            // when  year is 2 digits, so we first turn the year into a 4-digit year
            // before running adodb_mktime
            $year = carl_date('Y', adodb_mktime(1, 0, 0, 1, 1, $year));
        }
        return adodb_mktime((int) $hr, (int) $min, (int) $sec, (int) $month, (int) $day, (int) $year, $is_dst, $is_gmt);
    }
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:20,代码来源:date_funcs.php

示例5: arrayToDateTime

 /**
  * Converts a date array to a timestamp
  * year, month, day are obligatory !!
  *
  * @param array $dateArray Date Array
  *
  * @return int Timestamp
  */
 public static function arrayToDateTime($dateArray)
 {
     $hour = 0;
     $min = 0;
     $sec = 0;
     $dateValid = true;
     $month = $day = $year = null;
     if (!empty($dateArray['hours'])) {
         $hour = $dateArray['hours'];
     }
     if (!empty($dateArray['minutes'])) {
         $min = $dateArray['minutes'];
     }
     if (!empty($dateArray['seconds'])) {
         $sec = $dateArray['seconds'];
     }
     if (!empty($dateArray['day'])) {
         $day = $dateArray['day'];
     } else {
         $dateValid = false;
     }
     if (!empty($dateArray['month'])) {
         $month = $dateArray['month'];
     } else {
         $dateValid = false;
     }
     if (!empty($dateArray['year'])) {
         $year = $dateArray['year'];
     } else {
         $dateValid = false;
     }
     if ($dateValid) {
         return adodb_mktime($hour, $min, $sec, $month, $day, $year);
     } else {
         return adodb_mktime(0, 0, 0);
     }
 }
开发者ID:sintattica,项目名称:atk,代码行数:45,代码来源:DateTimeAttribute.php

示例6: ts

 public function ts()
 {
     return adodb_mktime($this->hour, $this->min, $this->sec, $this->month, $this->day, $this->year);
 }
开发者ID:BackupTheBerlios,项目名称:stato-svn,代码行数:4,代码来源:date.php

示例7: isset

include "../../../../include/network.php";
$var = isset($_GET["var"]) ? $_GET["var"] : "gdd50";
$year = isset($_GET["year"]) ? $_GET["year"] : date("Y");
$smonth = isset($_GET["smonth"]) ? $_GET["smonth"] : 5;
$sday = isset($_GET["sday"]) ? $_GET["sday"] : 1;
$emonth = isset($_GET["emonth"]) ? $_GET["emonth"] : date("m");
$eday = isset($_GET["eday"]) ? $_GET["eday"] : date("d");
$network = isset($_REQUEST["network"]) ? $_REQUEST["network"] : "IACLIMATE";
$nt = new NetworkTable($network);
$cities = $nt->table;
/** Need to use external date lib 
 * http://php.weblogs.com/adodb_date_time_library
 */
include "../../../../include/adodb-time.inc.php";
$sts = adodb_mktime(0, 0, 0, $smonth, $sday, $year);
$ets = adodb_mktime(0, 0, 0, $emonth, $eday, $year);
if ($sts > $ets) {
    $sts = $ets - 86400;
}
function mktitlelocal($map, $imgObj, $titlet)
{
    $layer = $map->getLayerByName("credits");
    // point feature with text for location
    $point = ms_newpointobj();
    $point->setXY(0, 10);
    $point->draw($map, $layer, $imgObj, 0, $titlet);
}
function plotNoData($map, $img)
{
    $layer = $map->getLayerByName("credits");
    $point = ms_newpointobj();
开发者ID:bthoover,项目名称:iem,代码行数:31,代码来源:gsplot.php

示例8: endOfWeek

 function endOfWeek($date)
 {
     $viewtime = adodb_mktime(0, 0, 0, substr($date, 5, 2), substr($date, 8, 2), substr($date, 0, 4));
     $weekday = strftime("%w", $viewtime);
     if ($weekday == 0) {
         $weekday = 7;
     }
     return date("Y-m-d", $viewtime - 86400 * ($weekday - 7));
 }
开发者ID:rezaul101,项目名称:erp32,代码行数:9,代码来源:dateutil.php

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

示例10: UnixTimeStamp

 static function UnixTimeStamp($v)
 {
     if (is_numeric(substr($v, 0, 1)) && ADODB_PHPVER >= 0x4200) {
         return parent::UnixTimeStamp($v);
     }
     global $ADODB_mssql_mths, $ADODB_mssql_date_order;
     //Dec 30 2000 12:00AM
     if ($ADODB_mssql_date_order == 'dmy') {
         if (!preg_match("|^([0-9]{1,2})[-/\\. ]+([A-Za-z]{3})[-/\\. ]+([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})|", $v, $rr)) {
             return parent::UnixTimeStamp($v);
         }
         if ($rr[3] <= TIMESTAMP_FIRST_YEAR) {
             return 0;
         }
         $theday = $rr[1];
         $themth = substr(strtoupper($rr[2]), 0, 3);
     } else {
         if (!preg_match("|^([A-Za-z]{3})[-/\\. ]+([0-9]{1,2})[-/\\. ]+([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})|", $v, $rr)) {
             return parent::UnixTimeStamp($v);
         }
         if ($rr[3] <= TIMESTAMP_FIRST_YEAR) {
             return 0;
         }
         $theday = $rr[2];
         $themth = substr(strtoupper($rr[1]), 0, 3);
     }
     $themth = $ADODB_mssql_mths[$themth];
     if ($themth <= 0) {
         return false;
     }
     switch (strtoupper($rr[6])) {
         case 'P':
             if ($rr[4] < 12) {
                 $rr[4] += 12;
             }
             break;
         case 'A':
             if ($rr[4] == 12) {
                 $rr[4] = 0;
             }
             break;
         default:
             break;
     }
     // h-m-s-MM-DD-YY
     return adodb_mktime($rr[4], $rr[5], 0, $themth, $theday, $rr[3]);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:47,代码来源:adodb-mssqlnative.inc.php

示例11: UnixTimeStamp

 /**
  * Also in ADORecordSet.
  * @param $v is a timestamp string in YYYY-MM-DD HH-NN-SS format
  *
  * @return date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format
  */
 function UnixTimeStamp($v)
 {
     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}))?|", $v, $rr)) {
         return false;
     }
     if ($rr[1] <= TIMESTAMP_FIRST_YEAR && $rr[2] <= 1) {
         return 0;
     }
     // h-m-s-MM-DD-YY
     if (!isset($rr[5])) {
         return adodb_mktime(0, 0, 0, $rr[2], $rr[3], $rr[1]);
     }
     return @adodb_mktime($rr[5], $rr[6], $rr[7], $rr[2], $rr[3], $rr[1]);
 }
开发者ID:BackupTheBerlios,项目名称:osiswebprinter,代码行数:20,代码来源:adodb-connection.inc.php

示例12: wpv_format_date

 function wpv_format_date()
 {
     $date_format = $_POST['date-format'];
     if ($date_format == '') {
         $date_format = get_option('date_format');
     }
     // this is needed to escape characters in the date_i18n function
     $date_format = str_replace('\\\\', '\\', $date_format);
     $date = $_POST['date'];
     // We can not be sure that the adodb_xxx functions are available, so we do different things whether they exist or not
     if (defined('ADODB_DATE_VERSION')) {
         $date = adodb_mktime(0, 0, 0, substr($date, 2, 2), substr($date, 0, 2), substr($date, 4, 4));
         echo json_encode(array('display' => adodb_date($date_format, $date), 'timestamp' => $date));
     } else {
         $date = mktime(0, 0, 0, substr($date, 2, 2), substr($date, 0, 2), substr($date, 4, 4));
         echo json_encode(array('display' => date_i18n($date_format, intval($date)), 'timestamp' => $date));
     }
     die;
 }
开发者ID:javierdlahoz,项目名称:paella-development,代码行数:19,代码来源:wpv.class.php

示例13: mkActiveTime

 function mkActiveTime($hr, $min, $sec, $month = false, $day = false, $year = false)
 {
     if (function_exists("adodb_mktime")) {
         return adodb_mktime($hr, $min, $sec, $month, $day, $year);
     } else {
         return mktime($hr, $min, $sec, $month, $day, $year);
     }
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:8,代码来源:class.activecalendar.php

示例14: CreateDateTime

 function CreateDateTime($hour, $min, $sec, $month, $day, $year)
 {
     if ($this->UseAdodbTime) {
         return adodb_mktime($hour, $min, $sec, $month, $day, $year);
     } else {
         return mktime($hour, $min, $sec, $month, $day, $year);
     }
 }
开发者ID:Ombogo,项目名称:new_api_chat,代码行数:8,代码来源:ganttfn.php

示例15: wpv_filter_parse_date_get_resulting_date

 function wpv_filter_parse_date_get_resulting_date($date_value, $format)
 {
     $date_value = (string) $date_value;
     if (!$format && strpos($date_value, ',') !== false) {
         $date_parts = explode(',', $date_value);
         $ret = adodb_mktime(0, 0, 0, $date_parts[1], $date_parts[0], $date_parts[2]);
         return $ret;
     } else {
         // just in case the Parser is not loaded yet
         if (class_exists('Toolset_DateParser') === false) {
             require_once dirname(__FILE__) . "/expression-parser/parser.php";
         }
         $date_string = trim(trim(str_replace(',', '/', $date_value), "'"));
         $date = Toolset_DateParser::parseDate($date_string, $format);
         if (is_object($date) && method_exists($date, 'getTimestamp')) {
             $timestamp = $date->getTimestamp();
             // NOTE this timestamp construction should be compatible with the adodb_xxx functions
             return $timestamp;
         }
         return $date_value;
     }
 }
开发者ID:axeljohansson1988,项目名称:oddcv,代码行数:22,代码来源:toolset.function.helpers.php


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