本文整理汇总了PHP中FabrikWorker::strToDateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikWorker::strToDateTime方法的具体用法?PHP FabrikWorker::strToDateTime怎么用?PHP FabrikWorker::strToDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FabrikWorker
的用法示例。
在下文中一共展示了FabrikWorker::strToDateTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderListData
/**
* shows the data formatted for the table view
* @param string data
* @param object all the data in the tables current row
* @return string formatted value
*/
function renderListData($data, $oAllRowsData)
{
if ($data != '') {
$format = '%Y-%m-%d %H:%i:%s';
$timebits = FabrikWorker::strToDateTime($data, $format);
$data = date('H:i:s', $timebits['timestamp']);
}
return $data;
}
示例2: tableDateToMySQL
/**
* convert a table formatted date string into a mySQL formatted date string
* (if already in mySQL format returns the date)
* @param string date in table view format
* @return string date in mySQL format or false if string date could not be converted
*/
function tableDateToMySQL($v)
{
$params =& $this->getParams();
$store_as_local = (int) $params->get('date_store_as_local', 0);
$format = $params->get('date_table_format', '%Y-%m-%d');
$b = FabrikWorker::strToDateTime($v, $format);
if (!is_array($b)) {
return false;
}
//3.0 can't use timestamp as that gets offset as its taken as numeric by JDate
//$orig = new JDate($datebits['timestamp'], 2);
$bstr = $b['year'] . '-' . $b['mon'] . '-' . $b['day'] . ' ' . $b['hour'] . ':' . $b['min'] . ':' . $b['sec'];
$date = JFactory::getDate($bstr);
if (in_array($v, $this->getNullDates()) || $v === $date->toMySQL()) {
return $v;
}
if ($store_as_local) {
$this->_resetToGMT = false;
}
$retval = $this->toMySQLGMT($date);
$this->_resetToGMT = true;
return $retval;
}
示例3: tableDateToMySQL
/**
* convert a table formatted date string into a mySQL formatted date string
* (if already in mySQL format returns the date)
* @param string date in table view format
* @return string date in mySQL format or false if string date could not be converted
*/
function tableDateToMySQL($v)
{
$params =& $this->getParams();
$store_as_local = (int) $params->get('date_store_as_local', 0);
if (in_array($v, $this->getNullDates()) || $v === JFactory::getDate($v)->toMySQL()) {
return $v;
}
$format = $params->get('date_table_format', '%Y-%m-%d');
$datebits = FabrikWorker::strToDateTime($v, $format);
if (!is_array($datebits)) {
return false;
}
$date =& JFactory::getDate($datebits['timestamp']);
if ($store_as_local) {
$this->_resetToGMT = false;
}
$retval = $this->toMySQLGMT($date);
$this->_resetToGMT = true;
return $retval;
}
示例4: tableDateToMySQL
/**
* Convert a table formatted date string into a mySQL formatted date string
* (if already in mySQL format returns the date)
*
* @param string $v date in table view format
*
* @deprecated not used
*
* @return string date in mySQL format or false if string date could not be converted
*/
protected function tableDateToMySQL($v)
{
$params = $this->getParams();
$store_as_local = (int) $params->get('date_store_as_local', 0);
$format = $params->get('date_table_format', '%Y-%m-%d');
$b = FabrikWorker::strToDateTime($v, $format);
if (!is_array($b)) {
return false;
}
$bstr = $b['year'] . '-' . $b['mon'] . '-' . $b['day'] . ' ' . $b['hour'] . ':' . $b['min'] . ':' . $b['sec'];
$date = JFactory::getDate($bstr);
if (in_array($v, $this->getNullDates()) || $v === $date->toSql()) {
return $v;
}
if ($store_as_local) {
$this->resetToGMT = false;
}
$retval = $this->toMySQLGMT($date);
$this->resetToGMT = true;
return $retval;
}