本文整理汇总了PHP中adodb_strftime函数的典型用法代码示例。如果您正苦于以下问题:PHP adodb_strftime函数的具体用法?PHP adodb_strftime怎么用?PHP adodb_strftime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了adodb_strftime函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adodb_gmstrftime
function adodb_gmstrftime($fmt, $ts = false)
{
return adodb_strftime($fmt, $ts, true);
}
示例2: idate
/**
* Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field.
* Function to use to build INSERT, UPDATE or WHERE predica
* @param param Date TMS to convert
* @return string Date in a string YYYYMMDDHHMMSS
*/
function idate($param)
{
return adodb_strftime("%Y-%m-%d %H:%M:%S", $param);
}
示例3: format
public function format($strf)
{
return utf8_encode(adodb_strftime($strf, $this->ts()));
}
示例4: idate
/**
* Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field.
* Function to use to build INSERT, UPDATE or WHERE predica
* @param param Date TMS to convert
* @return string Date in a string YYYYMMDDHHMMSS
*/
function idate($param)
{
return adodb_strftime("%Y%m%d%H%M%S", $param);
}
示例5: dol_print_date
//.........这里部分代码省略.........
if ($format == 'hourduration') {
$format = $outputlangs->trans("FormatHourShortDuration") != "FormatHourShortDuration" ? $outputlangs->trans("FormatHourShortDuration") : $conf->format_hour_short_duration;
}
if ($format == 'daytext') {
$format = $outputlangs->trans("FormatDateText") != "FormatDateText" ? $outputlangs->trans("FormatDateText") : $conf->format_date_text;
}
if ($format == 'daytextshort') {
$format = $outputlangs->trans("FormatDateTextShort") != "FormatDateTextShort" ? $outputlangs->trans("FormatDateTextShort") : $conf->format_date_text_short;
}
if ($format == 'dayhour') {
$format = $outputlangs->trans("FormatDateHourShort") != "FormatDateHourShort" ? $outputlangs->trans("FormatDateHourShort") : $conf->format_date_hour_short;
}
if ($format == 'dayhourtext') {
$format = $outputlangs->trans("FormatDateHourText") != "FormatDateHourText" ? $outputlangs->trans("FormatDateHourText") : $conf->format_date_hour_text;
}
if ($format == 'dayhourtextshort') {
$format = $outputlangs->trans("FormatDateHourTextShort") != "FormatDateHourTextShort" ? $outputlangs->trans("FormatDateHourTextShort") : $conf->format_date_hour_text_short;
}
// Format not sensitive to language
if ($format == 'dayhourlog') {
$format = '%Y%m%d%H%M%S';
}
if ($format == 'dayhourldap') {
$format = '%Y%m%d%H%M%SZ';
}
if ($format == 'dayhourxcard') {
$format = '%Y%m%dT%H%M%SZ';
}
if ($format == 'dayxcard') {
$format = '%Y%m%d';
}
if ($format == 'dayrfc') {
$format = '%Y-%m-%d';
}
// DATE_RFC3339
if ($format == 'dayhourrfc') {
$format = '%Y-%m-%dT%H:%M:%SZ';
}
// DATETIME RFC3339
// If date undefined or "", we return ""
if (dol_strlen($time) == 0) {
return '';
}
// $time=0 allowed (it means 01/01/1970 00:00:00)
//print 'x'.$time;
if (preg_match('/%b/i', $format)) {
// We inhibate translation to text made by strftime functions. We will use trans instead later.
$format = str_replace('%b', '__b__', $format);
$format = str_replace('%B', '__B__', $format);
}
if (preg_match('/%a/i', $format)) {
// We inhibate translation to text made by strftime functions. We will use trans instead later.
$format = str_replace('%a', '__a__', $format);
$format = str_replace('%A', '__A__', $format);
}
// Analyze date (deprecated) Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
if (preg_match('/^([0-9]+)\\-([0-9]+)\\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg) || preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) {
// This part of code should not be used.
dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page " . $_SERVER["PHP_SELF"], LOG_WARNING);
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
$syear = $reg[1];
$smonth = $reg[2];
$sday = $reg[3];
$shour = $reg[4];
$smin = $reg[5];
$ssec = $reg[6];
$time = dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear, true);
$ret = adodb_strftime($format, $time + $offsettz + $offsetdst, $to_gmt);
} else {
// Date is a timestamps
if ($time < 100000000000) {
$ret = adodb_strftime($format, $time + $offsettz + $offsetdst, $to_gmt);
} else {
$ret = 'Bad value ' . $time . ' for date';
}
}
if (preg_match('/__b__/i', $format)) {
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
$month = adodb_strftime('%m', $time + $offsettz + $offsetdst);
if ($encodetooutput) {
$monthtext = $outputlangs->transnoentities('Month' . $month);
$monthtextshort = $outputlangs->transnoentities('MonthShort' . $month);
} else {
$monthtext = $outputlangs->transnoentitiesnoconv('Month' . $month);
$monthtextshort = $outputlangs->transnoentitiesnoconv('MonthShort' . $month);
}
//print 'monthtext='.$monthtext.' monthtextshort='.$monthtextshort;
$ret = str_replace('__b__', $monthtextshort, $ret);
$ret = str_replace('__B__', $monthtext, $ret);
//print 'x'.$outputlangs->charset_output.'-'.$ret.'x';
//return $ret;
}
if (preg_match('/__a__/i', $format)) {
$w = adodb_strftime('%w', $time + $offsettz + $offsetdst);
$dayweek = $outputlangs->transnoentitiesnoconv('Day' . $w);
$ret = str_replace('__A__', $dayweek, $ret);
$ret = str_replace('__a__', dol_substr($dayweek, 0, 3), $ret);
}
return $ret;
}
示例6: timeToStr
function timeToStr($int)
{
global $pommo;
if (!defined('ADODB_DATE_VERSION')) {
// safely load ADODB date library
Pommo::requireOnce($pommo->_baseDir . 'inc/lib/adodb/adodb-time.inc.php');
}
switch ($pommo->_dateformat) {
case 1:
$format = '%Y/%m/%d';
break;
case 2:
$format = '%m/%d/%Y';
break;
case 3:
$format = '%d/%m/%Y';
break;
default:
Pommo::kill('Unknown dateformat', TRUE);
}
return adodb_strftime($format, $int);
}
示例7: carl_strftime
/**
* Alias for adodb_strftime()
*/
function carl_strftime($format, $timestamp = false, $is_gmt = false)
{
return adodb_strftime($format, $timestamp, $is_gmt);
}
示例8: dol_print_date
//.........这里部分代码省略.........
$format = '%Y%m%d%H%M%SZ';
} else {
if ($format == 'dayhourxcard') {
$format = '%Y%m%dT%H%M%SZ';
} else {
if ($format == 'dayxcard') {
$format = '%Y%m%d';
} else {
if ($format == 'dayrfc') {
$format = '%Y-%m-%d';
} else {
if ($format == 'dayhourrfc') {
$format = '%Y-%m-%dT%H:%M:%SZ';
} else {
if ($format == 'standard') {
$format = '%Y-%m-%d %H:%M:%S';
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if ($reduceformat) {
$format = str_replace('%Y', '%y', $format);
$format = str_replace('yyyy', 'yy', $format);
}
// If date undefined or "", we return ""
if (dol_strlen($time) == 0) {
return '';
}
// $time=0 allowed (it means 01/01/1970 00:00:00)
// Clean format
if (preg_match('/%b/i', $format)) {
// We inhibate translation to text made by strftime functions. We will use trans instead later.
$format = str_replace('%b', '__b__', $format);
$format = str_replace('%B', '__B__', $format);
}
if (preg_match('/%a/i', $format)) {
// We inhibate translation to text made by strftime functions. We will use trans instead later.
$format = str_replace('%a', '__a__', $format);
$format = str_replace('%A', '__A__', $format);
}
// Analyze date
if (preg_match('/^([0-9]+)\\-([0-9]+)\\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg) || preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) {
// This part of code should not be used. TODO Remove this.
dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page " . $_SERVER["PHP_SELF"], LOG_WARNING);
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
$syear = !empty($reg[1]) ? $reg[1] : '';
$smonth = !empty($reg[2]) ? $reg[2] : '';
$sday = !empty($reg[3]) ? $reg[3] : '';
$shour = !empty($reg[4]) ? $reg[4] : '';
$smin = !empty($reg[5]) ? $reg[5] : '';
$ssec = !empty($reg[6]) ? $reg[6] : '';
$time = dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear, true);
$ret = adodb_strftime($format, $time + $offsettz + $offsetdst, $to_gmt);
} else {
// Date is a timestamps
if ($time < 100000000000) {
$ret = adodb_strftime($format, $time + $offsettz + $offsetdst, $to_gmt);
// TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
} else {
$ret = 'Bad value ' . $time . ' for date';
}
}
if (preg_match('/__b__/i', $format)) {
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
$month = adodb_strftime('%m', $time + $offsettz + $offsetdst);
// TODO Remove this
if ($encodetooutput) {
$monthtext = $outputlangs->transnoentities('Month' . $month);
$monthtextshort = $outputlangs->transnoentities('MonthShort' . $month);
} else {
$monthtext = $outputlangs->transnoentitiesnoconv('Month' . $month);
$monthtextshort = $outputlangs->transnoentitiesnoconv('MonthShort' . $month);
}
//print 'monthtext='.$monthtext.' monthtextshort='.$monthtextshort;
$ret = str_replace('__b__', $monthtextshort, $ret);
$ret = str_replace('__B__', $monthtext, $ret);
//print 'x'.$outputlangs->charset_output.'-'.$ret.'x';
//return $ret;
}
if (preg_match('/__a__/i', $format)) {
$w = adodb_strftime('%w', $time + $offsettz + $offsetdst);
// TODO Remove this
$dayweek = $outputlangs->transnoentitiesnoconv('Day' . $w);
$ret = str_replace('__A__', $dayweek, $ret);
$ret = str_replace('__a__', dol_substr($dayweek, 0, 3), $ret);
}
return $ret;
}