當前位置: 首頁>>代碼示例>>PHP>>正文


PHP LocaleUtil::convertToXpDateFormat方法代碼示例

本文整理匯總了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));
 }
開發者ID:THM068,項目名稱:orangehrm,代碼行數:30,代碼來源:LocaleUtilTest.php

示例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 {
開發者ID:googlecode-mirror,項目名稱:pucit-orangehrm,代碼行數:31,代碼來源:timesheetEdit.php

示例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;
 }
開發者ID:lahirwisada,項目名稱:orangehrm,代碼行數:23,代碼來源:LocaleUtil.php


注:本文中的LocaleUtil::convertToXpDateFormat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。