本文整理汇总了PHP中LocaleUtil::convertToXpDateFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP LocaleUtil::convertToXpDateFormat方法的具体用法?PHP LocaleUtil::convertToXpDateFormat怎么用?PHP LocaleUtil::convertToXpDateFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocaleUtil
的用法示例。
在下文中一共展示了LocaleUtil::convertToXpDateFormat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testConvertToXpDateFormat
public function testConvertToXpDateFormat()
{
$formatStr = 'Y-m-d';
$xpFormatStr = 'yyyy-MM-dd';
$this->assertEquals($xpFormatStr, LocaleUtil::convertToXpDateFormat($formatStr));
$formatStr = 'y-m-d';
$xpFormatStr = 'yy-MM-dd';
$this->assertEquals($xpFormatStr, LocaleUtil::convertToXpDateFormat($formatStr));
$formatStr = 'Y-n-d';
$xpFormatStr = 'yyyy-M-dd';
$this->assertEquals($xpFormatStr, LocaleUtil::convertToXpDateFormat($formatStr));
$formatStr = 'Y-m-j';
$xpFormatStr = 'yyyy-MM-d';
$this->assertEquals($xpFormatStr, LocaleUtil::convertToXpDateFormat($formatStr));
$formatStr = 'H:i:s';
$xpFormatStr = 'HH:mm:ss';
$this->assertEquals($xpFormatStr, LocaleUtil::convertToXpDateFormat($formatStr));
$formatStr = 'h:i:s';
$xpFormatStr = 'hh:mm:ss';
$this->assertEquals($xpFormatStr, LocaleUtil::convertToXpDateFormat($formatStr));
$formatStr = 'G:i:s';
$xpFormatStr = 'H:mm:ss';
$this->assertEquals($xpFormatStr, LocaleUtil::convertToXpDateFormat($formatStr));
$formatStr = 'g:i:s';
$xpFormatStr = 'h:mm:ss';
$this->assertEquals($xpFormatStr, LocaleUtil::convertToXpDateFormat($formatStr));
$formatStr = 'Y-m-d H:i';
$xpFormatStr = 'yyyy-MM-dd HH:mm';
$this->assertEquals($xpFormatStr, LocaleUtil::convertToXpDateFormat($formatStr));
}
示例2: strtotime
break;
case Timesheet::TIMESHEET_STATUS_APPROVED:
$statusStr = $lang_Time_Timesheet_Status_Approved;
break;
case Timesheet::TIMESHEET_STATUS_REJECTED:
$statusStr = $lang_Time_Timesheet_Status_Rejected;
break;
}
$startDate = strtotime($timesheet->getStartDate() . " 00:00:00");
$endDate = strtotime($timesheet->getEndDate() . " 23:59:59");
$startDatePrint = LocaleUtil::getInstance()->formatDateTime(date("Y-m-d H:i", $startDate));
$endDatePrint = LocaleUtil::getInstance()->formatDateTime(date("Y-m-d H:i", $endDate));
$row = 0;
$sysConf = new sysConf();
$dateFormat = LocaleUtil::convertToXpDateFormat($sysConf->getDateFormat());
$timeFormat = LocaleUtil::convertToXpDateFormat($sysConf->getTimeFormat());
?>
<style type="text/css">
.tableTopLeft {
background: none;
}
.tableTopMiddle {
background: none;
}
.tableTopRight {
background: none;
}
.tableMiddleLeft {
background: none;
}
.tableMiddleRight {
示例3: convertToStandardDateTimeFormat
/**
* String time will be converted from the custom format to YYY-mm-dd HH:MM
*
* Right now only English dates will be convered.
*
* @param String time
* @param String customFormat (Optional)
* @return String standardDate time
*/
public function convertToStandardDateTimeFormat($time, $customFormat = null)
{
if ($customFormat == null) {
$format = LocaleUtil::convertToXpDateFormat("{$this->sysConf->getDateFormat()} {$this->sysConf->getTimeFormat()}");
} else {
$format = LocaleUtil::convertToXpDateFormat($customFormat);
}
$timeStamp = $this->_customFormatStringToTimeStamp($time, $format);
if (!$timeStamp) {
return null;
}
$standardDate = date(self::STANDARD_DATETIME_FORMAT, $timeStamp);
return $standardDate;
}