本文整理汇总了PHP中db2time函数的典型用法代码示例。如果您正苦于以下问题:PHP db2time函数的具体用法?PHP db2time怎么用?PHP db2time使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db2time函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showDBValue
public function showDBValue(&$data, $keylink)
{
$result = "";
if (IsDateFieldType($this->fieldType)) {
$result = str_format_time(db2time($data[$this->field]));
} else {
$numbers = parsenumbers($data[$this->field]);
if (!count($numbers)) {
return "";
}
while (count($numbers) < 3) {
$numbers[] = 0;
}
$result = str_format_time(array(0, 0, 0, $numbers[0], $numbers[1], $numbers[2]));
}
return $this->checkForEncoding($result, $keylink);
}
示例2: getTextValue
/**
* @param &Array data
* @return String
*/
public function getTextValue(&$data)
{
$result = "";
if (IsDateFieldType($this->fieldType)) {
return str_format_time(db2time($data[$this->field]));
}
$numbers = parsenumbers($data[$this->field]);
if (!count($numbers)) {
return "";
}
while (count($numbers) < 3) {
$numbers[] = 0;
}
if (count($numbers) == 6) {
return str_format_time(array(0, 0, 0, $numbers[3], $numbers[4], $numbers[5]));
}
// sometimes data is datetime
return str_format_time(array(0, 0, 0, $numbers[0], $numbers[1], $numbers[2]));
}
示例3: UnlockAdmin
function UnlockAdmin($strtable, $keys, $startEdit)
{
$skeys = "";
foreach ($keys as $ind => $val) {
if (strlen($skeys)) {
$skeys .= "&";
}
$skeys .= rawurlencode($val);
}
$sdate = now();
if ($startEdit) {
// add a record - lock
$this->TableObj->startdatetime = $sdate;
$this->TableObj->confirmdatetime = $sdate;
$this->TableObj->sessionid = session_id();
$this->TableObj->table = $strtable;
$this->TableObj->keys = $skeys;
$this->TableObj->userid = $this->UserID;
$this->TableObj->action = 1;
$this->TableObj->Add();
}
// delete all other locking records
$rstmp = CustomQuery("delete from " . AddTableWrappers($this->lockTableName) . " where " . AddFieldWrappers("table") . "=" . db_prepare_string($strtable) . " and " . AddFieldWrappers("keys") . "=" . db_prepare_string($skeys) . " and " . AddFieldWrappers("action") . "=1 and " . AddFieldWrappers("sessionid") . "<>'" . session_id() . "' ");
// inform other users that their locking were removed by locking
$rstmp = CustomQuery("delete from " . AddTableWrappers($this->lockTableName) . " where " . AddFieldWrappers("startdatetime") . "<'" . format_datetime_custom(adddays(db2time(now()), -2), "yyyy-MM-dd HH:mm:ss") . "' and " . AddFieldWrappers("action") . "=2");
$this->TableObj->startdatetime = $sdate;
$this->TableObj->confirmdatetime = $sdate;
$this->TableObj->sessionid = session_id();
$this->TableObj->table = $strtable;
$this->TableObj->keys = $skeys;
$this->TableObj->userid = $this->UserID;
$this->TableObj->action = 2;
$this->TableObj->Add();
}
示例4: getValForTimePicker
/**
* Get value for field edit as time and get dpTime settings
* @param integer $convention - 24 or 12 hours format for timePicker
* @param string $type - type of field
* @param string $value - value of field
* @param boolean $useTimePicker - use timePicker or not
* @return array
*/
function getValForTimePicker($type, $value, $locale)
{
$val = "";
$dbtime = array();
if (IsDateFieldType($type)) {
$dbtime = db2time($value);
if (count($dbtime)) {
$val = format_datetime_custom($dbtime, $locale);
}
} else {
$arr = parsenumbers($value);
if (count($arr)) {
while (count($arr) < 3) {
$arr[] = 0;
}
$dbtime = array(0, 0, 0, $arr[0], $arr[1], $arr[2]);
$val = format_datetime_custom($dbtime, $locale);
}
}
return array('val' => $val, 'dbTime' => $dbtime);
}
示例5: toPHPTime
/**
* @intellisense
*/
function toPHPTime($datevalue)
{
$arr = db2time($datevalue);
return mktime($arr[3], $arr[4], $arr[5], $arr[1], $arr[2], $arr[0]);
}
示例6: getKey
function getKey($data)
{
if (!$this->_recordBasedRequest) {
if ($this->_interval == 0) {
return $data[$this->alias()];
} else {
$key = array();
for ($nCnt = $this->_start; $nCnt < $this->_interval + $this->_start; $nCnt++) {
$key[] = $data[$this->_alias . $nCnt];
}
return join('-', $key);
}
} else {
$strdate = $data[$this->_name];
if ($strdate == null) {
return 'NULL';
}
if ($this->_interval == 0) {
return $strdate;
} else {
switch ($this->_interval) {
case 1:
$date = cached_db2time($strdate);
return $date[0];
case 2:
$date = cached_db2time($strdate);
return $date[0] . '-' . intval($date[1] / 3);
case 3:
$date = cached_db2time($strdate);
return $date[0] . '-' . $date[1];
case 4:
$start = cached_getweekstart($strdate);
return $start[0] . '-' . $start[1] . '-' . $start[2];
case 5:
$date = cached_db2time($strdate);
return $date[0] . '-' . $date[1] . '-' . $date[2];
case 6:
$date = db2time($strdate);
return $date[0] . '-' . $date[1] . '-' . $date[2] . '-' . $date[3];
case 7:
$date = db2time($strdate);
return $date[0] . '-' . $date[1] . '-' . $date[2] . '-' . $date[3] . '-' . $date[4];
}
}
}
}
示例7: UnlockAdmin
function UnlockAdmin($strtable, $keys, $startEdit)
{
$skeys = "";
foreach ($keys as $ind => $val) {
if (strlen($skeys)) {
$skeys .= "&";
}
$skeys .= rawurlencode($val);
}
$sdate = now();
if ($startEdit) {
// add a record - lock
$this->insert($strtable, $sdate, $sdate, $skeys, session_id(), $this->UserID, 1);
}
// delete all other locking records
$where = $this->connection->addFieldWrappers("table") . "=" . $this->connection->prepareString($strtable) . " AND " . $this->connection->addFieldWrappers("keys") . "=" . $this->connection->prepareString($skeys) . " AND " . $this->connection->addFieldWrappers("action") . "=1 AND " . $this->connection->addFieldWrappers("sessionid") . "<>" . $this->connection->prepareString(session_id());
$this->delete($where);
// inform other users that their locking were removed by locking
$where = $this->connection->addFieldWrappers("startdatetime") . "<" . $this->connection->addDateQuotes(format_datetime_custom(adddays(db2time(now()), -2), "yyyy-MM-dd HH:mm:ss")) . " AND " . $this->connection->addFieldWrappers("action") . "=2";
$this->delete($where);
$this->insert($strtable, $sdate, $sdate, $skeys, session_id(), $this->UserID, 2);
}
示例8: showDBValue
public function showDBValue(&$data, $keylink)
{
return format_shortdate(db2time($data[$this->field]));
}
示例9: buildControl
function buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data)
{
global $locale_info;
parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data);
if ($fieldNum) {
$this->cfield = "value" . $fieldNum . "_" . GoodFieldName($this->field) . '_' . $this->id;
}
echo '<input id="' . $this->ctype . '" type="hidden" name="' . $this->ctype . '" value="date' . $this->pageObject->pSetEdit->getDateEditType($this->field) . '">';
if ($this->pageObject->pageType == PAGE_LIST) {
$pSet = new ProjectSettings($this->pageObject->tName, PAGE_SEARCH);
} else {
$pSet = $this->pageObject->pSetEdit;
}
$tvalue = $value;
$time = db2time($tvalue);
if (!count($time)) {
$time = array(0, 0, 0, 0, 0, 0);
}
$dp = 0;
$hasImgCal = true;
$showTime = $pSet->dateEditShowTime($this->field);
switch ($pSet->getDateEditType($this->field)) {
case EDIT_DATE_SIMPLE_INLINE:
$hasImgCal = false;
case EDIT_DATE_SIMPLE_DP:
$ovalue = $value;
if ($locale_info["LOCALE_IDATE"] == 1) {
$fmt = "dd" . $locale_info["LOCALE_SDATE"] . "MM" . $locale_info["LOCALE_SDATE"] . "yyyy";
} else {
if ($locale_info["LOCALE_IDATE"] == 0) {
$fmt = "MM" . $locale_info["LOCALE_SDATE"] . "dd" . $locale_info["LOCALE_SDATE"] . "yyyy";
} else {
$fmt = "yyyy" . $locale_info["LOCALE_SDATE"] . "MM" . $locale_info["LOCALE_SDATE"] . "dd";
}
}
if ($showTime || $time[3] || $time[4] || $time[5]) {
$fmt .= " HH:mm:ss";
}
if ($time[0]) {
$ovalue = format_datetime_custom($time, $fmt);
}
$ovalue1 = $time[2] . "-" . $time[1] . "-" . $time[0];
if ($showTime || $time[3] || $time[4] || $time[5]) {
$ovalue1 .= " " . $time[3] . ":" . $time[4] . ":" . $time[5];
}
// need to create date control object to use it with datePicker
$ret = '<input id="' . $this->cfield . '" ' . $this->inputStyle . ' type="Text" name="' . $this->cfield . '" value="' . $ovalue . '">';
$ret .= '<input id="ts' . $this->cfield . '" type="Hidden" name="ts' . $this->cfield . '" value="' . $ovalue1 . '">';
if ($hasImgCal) {
$ret .= ' <a href="#" id="imgCal_' . $this->cfield . '" data-icon="calendar" title="Click Here to Pick up the date" ></a>';
}
echo $ret;
break;
case EDIT_DATE_DD_INLINE:
case EDIT_DATE_DD_DP:
$dp = 1;
case EDIT_DATE_DD:
$controlWidth = $pSet->getControlWidth($this->field);
if ($controlWidth > 0) {
$controlWidth -= 10;
$yearWidth = floor($controlWidth * 0.3);
$yearStyle = 'style="min-width: ' . $yearWidth . 'px; ';
$dayWidth = floor($controlWidth * 0.2);
$dayStyle = 'style="min-width: ' . $dayWidth . 'px; margin-right:5px;" ';
$mothWidth = $controlWidth - $yearWidth - $dayWidth;
$monthStyle = 'style="min-width: ' . $mothWidth . 'px; margin-right:5px;" ';
} else {
$dayStyle = '';
$monthStyle = '';
$yearStyle = '';
}
$alt = ($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 ? 'alt="' . $this->strLabel . '" ' : '';
$retday = '<select id="day' . $this->cfield . '" ' . $dayStyle . $alt . 'name="day' . $this->cfield . '" ></select>';
$retmonth = '<select id="month' . $this->cfield . '" ' . $monthStyle . $alt . 'name="month' . $this->cfield . '" ></select>';
$retyear = '<select id="year' . $this->cfield . '" ' . $yearStyle . $alt . 'name="year' . $this->cfield . '" ></select>';
$space = $controlWidth > 0 ? '' : " ";
if ($locale_info["LOCALE_ILONGDATE"] == 1) {
$ret = $retday . $space . $retmonth . $space . $retyear;
} else {
if ($locale_info["LOCALE_ILONGDATE"] == 0) {
$ret = $retmonth . $space . $retday . $space . $retyear;
} else {
$ret = $retyear . $space . $retmonth . $space . $retday;
}
}
if ($time[0] && $time[1] && $time[2]) {
$ret .= "<input id=\"" . $this->cfield . "\" type=hidden name=\"" . $this->cfield . "\" value=\"" . $time[0] . "-" . $time[1] . "-" . $time[2] . "\">";
} else {
$ret .= "<input id=\"" . $this->cfield . "\" type=hidden name=\"" . $this->cfield . "\" value=\"\">";
}
// calendar handling for three DD
if ($dp) {
$ret .= ' <a href="#" id="imgCal_' . $this->cfield . '" data-icon="calendar" title="Click Here to Pick up the date"></a>' . '<input id="ts' . $this->cfield . '" type=hidden name="ts' . $this->cfield . '" value="' . $time[2] . '-' . $time[1] . '-' . $time[0] . '">';
}
echo $ret;
break;
default:
// case EDIT_DATE_SIMPLE:
$ovalue = $value;
if ($time[0]) {
//.........这里部分代码省略.........
示例10: getDateSliderWhere
/**
* Get the date slider's where
* @return string
*/
static function getDateSliderWhere($fName, $pSet, $cipherer, $table, $SearchFor, $SearchFor2, $strSearchOption, $fullFieldName)
{
$firstDelimPos = strpos($SearchFor, "-");
$lastDelimPos = strrpos($SearchFor, "-");
if ($firstDelimPos === FALSE || $firstDelimPos == $lastDelimPos) {
return "";
}
$stepType = $pSet->getFilterStepType($fName);
$timeValueEnvolved = false;
if ($stepType == FSST_SECONDS || $stepType == FSST_MINUTES || $stepType == FSST_HOURS) {
$timeValueEnvolved = true;
}
$value1 = $cipherer->MakeDBValue($fName, $SearchFor, "", true);
switch ($strSearchOption) {
case "slider":
$firstDelimPos = strpos($SearchFor2, "-");
$lastDelimPos = strrpos($SearchFor2, "-");
if ($firstDelimPos === FALSE || $firstDelimPos == $lastDelimPos) {
return "";
}
$cleanvalue2 = prepare_for_db($fName, $SearchFor2, "");
$timeArr = db2time($cleanvalue2);
if (!$timeValueEnvolved) {
// for dates without time, add one day
$timeArr = adddays($timeArr, 1);
$value2 = $timeArr[0] . "-" . $timeArr[1] . "-" . $timeArr[2];
} else {
if ($stepType == FSST_SECONDS) {
$timeArr = addSeconds($timeArr, 1);
} else {
$timeArr = addMinutes($timeArr, 1);
}
$dateString = $timeArr[0] . "-" . $timeArr[1] . "-" . $timeArr[2];
$hours = $timeArr[3] < 10 ? '0' . $timeArr[3] : $timeArr[3];
$minutes = $timeArr[4] < 10 ? '0' . $timeArr[4] : $timeArr[4];
$seconds = $timeArr[5] < 10 ? '0' . $timeArr[5] : $timeArr[5];
$timeString = $hours . ":" . $minutes . ":" . $seconds;
$value2 = $dateString . " " . $timeString;
}
$value2 = add_db_quotes($fName, $value2, $table);
return $fullFieldName . ">=" . $value1 . " and " . $fullFieldName . "<" . $value2;
case 'moreequal':
return $fullFieldName . ">=" . $value1;
case 'lessequal':
return $fullFieldName . "<=" . $value1;
default:
return "";
}
}
示例11: SQLWhere
/**
* Get the WHERE clause conditions string for the search or suggest SQL query
* @param String SearchFor
* @param String strSearchOption
* @param String SearchFor2
* @param String etype
* @param Boolean isSuggest
* @return String
*/
function SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest)
{
if ($this->lookupType == LT_LISTOFVALUES) {
return parent::SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest);
}
$baseResult = $this->baseSQLWhere($strSearchOption);
if ($baseResult === false) {
return "";
}
if ($baseResult !== "") {
return $baseResult;
}
if ($this->connection->dbType != nDATABASE_MySQL) {
$this->btexttype = IsTextType($this->type);
}
if ($this->multiselect && $strSearchOption != "Equals") {
$SearchFor = splitvalues($SearchFor);
} else {
$SearchFor = array($SearchFor);
}
$gstrField = $this->getFieldSQLDecrypt();
$gstrField = $this->getFieldSQLDecrypt();
if (($strSearchOption == "Starts with" || $strSearchOption == "Contains") && (!IsCharType($this->type) || $this->btexttype)) {
$gstrField = $this->connection->field2char($gstrField, $this->type);
}
$ret = "";
foreach ($SearchFor as $searchItem) {
$value = $searchItem;
if ($value == "null" || $value == "Null" || $value == "") {
continue;
}
if (strlen(trim($ret))) {
$ret .= " or ";
}
if (($strSearchOption == "Starts with" || $strSearchOption == "Contains") && !$this->multiselect) {
$value = $this->connection->escapeLIKEpattern($value);
if ($strSearchOption == "Starts with") {
$value .= '%';
}
if ($strSearchOption == "Contains") {
$value = '%' . $value . '%';
}
}
if ($strSearchOption != "Starts with" && $strSearchOption != "Contains") {
$value = make_db_value($this->field, $value);
}
$searchIsCaseInsensitive = $this->pageObject->pSetEdit->getNCSearch();
if ($strSearchOption == "Equals" && !($value == "null" || $value == "Null")) {
$condition = $gstrField . '=' . $value;
} else {
if (($strSearchOption == "Starts with" || $strSearchOption == "Contains") && !$this->multiselect) {
$condition = $gstrField . " " . $this->like . " " . $this->connection->prepareString($value);
} else {
if ($strSearchOption == "More than") {
$condition = $gstrField . " > " . $value;
} else {
if ($strSearchOption == "Less than") {
$condition = $gstrField . "<" . $value;
} else {
if ($strSearchOption == "Equal or more than") {
$condition = $gstrField . ">=" . $value1;
} else {
if ($strSearchOption == "Equal or less than") {
$condition = $gstrField . "<=" . $value1;
} else {
if ($strSearchOption == "Between") {
$value2 = $this->connection->prepareString($SearchFor2);
if ($this->lookupType == LT_QUERY && IsCharType($this->type) && !$this->btexttype && $searchIsCaseInsensitive) {
$value2 = $this->connection->upper($value2);
}
$condition = $gstrField . ">=" . $value . " and ";
if (IsDateFieldType($this->type)) {
$timeArr = db2time($SearchFor2);
// for dates without time, add one day
if ($timeArr[3] == 0 && $timeArr[4] == 0 && $timeArr[5] == 0) {
$timeArr = adddays($timeArr, 1);
$SearchFor2 = $timeArr[0] . "-" . $timeArr[1] . "-" . $timeArr[2];
$SearchFor2 = add_db_quotes($this->field, $SearchFor2, $this->tName);
$condition .= $gstrField . "<" . $SearchFor2;
} else {
$condition .= $gstrField . "<=" . $value2;
}
} else {
$condition .= $gstrField . "<=" . $value2;
}
} else {
if ($this->multiselect) {
if (strpos($value, ",") !== false || strpos($value, '"') !== false) {
$value = '"' . str_replace('"', '""', $value) . '"';
}
$fullFieldName = $this->getFieldSQLDecrypt();
//.........这里部分代码省略.........
示例12: getTextValue
/**
* @param &Array data
* @return String
*/
public function getTextValue(&$data)
{
return str_format_datetime(db2time($data[$this->field]));
}
示例13: SQLWhere
function SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest)
{
if ($this->lookupType == LT_LISTOFVALUES) {
return parent::SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest);
}
$baseResult = $this->baseSQLWhere($strSearchOption);
if ($baseResult === false) {
return "";
}
if ($baseResult != "") {
return $baseResult;
}
$displayFieldType = $this->type;
if ($this->lookupType == LT_QUERY) {
$displayFieldType = $this->lookupPSet->getFieldType($this->field);
$this->btexttype = IsTextType($displayFieldType);
}
if ($this->multiselect) {
$SearchFor = splitvalues($SearchFor);
} else {
$SearchFor = array($SearchFor);
}
$ret = "";
if ($this->linkAndDisplaySame) {
$gstrField = GetFullFieldName($this->field, "", false);
} else {
$gstrField = GetFullFieldName($this->displayFieldName, $this->lookupTable, false);
}
if ($this->customDisplay) {
$gstrField = $this->lwDisplayFieldWrapped;
} else {
if (!$this->linkAndDisplaySame && $this->lookupType == LT_QUERY && IsCharType($displayFieldType) && !$this->btexttype && !$this->ciphererDisplay->isFieldPHPEncrypted($this->displayFieldName)) {
$gstrField = $this->lookupPSet->isEnableUpper(GetFullFieldName($this->displayFieldName, $this->lookupTable, false));
}
}
foreach ($SearchFor as $value) {
if (!($value == "null" || $value == "Null" || $value == "")) {
if (strlen(trim($ret))) {
$ret .= " or ";
}
if (!$this->multiselect) {
if ($strSearchOption == "Starts with") {
$value .= '%';
}
if ($isSuggest || $strSearchOption == "Contains") {
$value = '%' . $value . '%';
}
if ($isSuggest || $strSearchOption == "Contains" || $strSearchOption == "Starts with" || $strSearchOption == "More than" || $strSearchOption == "Less than" || $strSearchOption == "Equal or more than" || $strSearchOption == "Equal or less than" || $strSearchOption == "Between" || $strSearchOption == "Equals" && $this->LCType == LCT_AJAX && !$this->linkAndDisplaySame) {
$value = $this->escapeSearchValForMySQL($value);
if ($this->lookupType == LT_QUERY && IsCharType($displayFieldType) && !$this->btexttype) {
$value = $this->lookupPSet->isEnableUpper(db_prepare_string($value));
} else {
$value = db_prepare_string($value);
}
} else {
if ($strSearchOption == "Equals") {
$value = make_db_value($this->field, $value);
}
}
}
if ($strSearchOption == "Equals") {
if (!($value == "null" || $value == "Null")) {
if ($this->LCType == LCT_AJAX && !$this->linkAndDisplaySame) {
$condition = $gstrField . '=' . $value;
} else {
$condition = GetFullFieldName($this->field, "", false) . '=' . $value;
}
}
} else {
if ($strSearchOption == "Starts with" || $strSearchOption == "Contains" && !$this->multiselect) {
$condition = $gstrField . " " . $this->like . " " . $value;
} else {
if ($strSearchOption == "More than") {
$condition = $gstrField . " > " . $value;
} else {
if ($strSearchOption == "Less than") {
$condition = $gstrField . "<" . $value;
} else {
if ($strSearchOption == "Equal or more than") {
$condition = $gstrField . ">=" . $value1;
} else {
if ($strSearchOption == "Equal or less than") {
$condition = $gstrField . "<=" . $value1;
} else {
if ($strSearchOption == "Between") {
if ($this->lookupType == LT_QUERY && IsCharType($displayFieldType) && !$this->btexttype) {
$value2 = $this->lookupPSet->isEnableUpper(db_prepare_string($SearchFor2));
} else {
$value2 = db_prepare_string($SearchFor2);
}
$condition = $gstrField . ">=" . $value . " and ";
if (IsDateFieldType($this->type)) {
$timeArr = db2time($SearchFor2);
// for dates without time, add one day
if ($timeArr[3] == 0 && $timeArr[4] == 0 && $timeArr[5] == 0) {
$timeArr = adddays($timeArr, 1);
$SearchFor2 = $timeArr[0] . "-" . $timeArr[1] . "-" . $timeArr[2];
$SearchFor2 = add_db_quotes($this->field, $SearchFor2, $this->pageObject->tName);
$condition .= $gstrField . "<" . $SearchFor2;
} else {
//.........这里部分代码省略.........
示例14: addDateQuotes
/**
* @param Mixed $val
* @return String
*/
public function addDateQuotes($val)
{
$arrDate = db2time($val);
return "'" . $arrDate[0] . "-" . $arrDate[1] . "-" . $arrDate[2] . " " . $arrDate[3] . ":" . $arrDate[4] . ":" . $arrDate[5] . "'";
}
示例15: getTextValue
/**
* @param &Array data
* @return String
*/
public function getTextValue(&$data)
{
return format_shortdate(db2time($data[$this->field]));
}