mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-08 19:42:15 +09:00
간단한 코드 정리
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4078 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
ebfa5ee64c
commit
cb4002b2ba
1 changed files with 10 additions and 9 deletions
|
|
@ -262,22 +262,23 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief YYYYMMDDHHIISS 형식의 시간값을 원하는 시간 포맷으로 변형
|
* @brief YYYYMMDDHHIISS 형식의 시간값을 원하는 시간 포맷으로 변형
|
||||||
* @param str YYYYMMDDHHIISS 형식의 시간값
|
* @param string|int str YYYYMMDDHHIISS 형식의 시간 값
|
||||||
* @param format php date()함수의 시간 포맷
|
* @param string format php date()함수의 시간 포맷
|
||||||
|
* @param bool conversion 언어에 따라 날짜 포맷의 자동변환 여부
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
function zdate($str, $format = "Y-m-d H:i:s", $conversion=true) {
|
function zdate($str, $format = 'Y-m-d H:i:s', $conversion=true) {
|
||||||
// 대상 시간이 없으면 null return
|
// 대상 시간이 없으면 null return
|
||||||
if(!$str) return;
|
if(!$str) return;
|
||||||
|
|
||||||
// 언어권에 따라서 지정된 날짜 포맷을 변경
|
// 언어권에 따라서 지정된 날짜 포맷을 변경
|
||||||
if($conversion == true) {
|
if($conversion == true) {
|
||||||
switch(Context::getLangType()) {
|
switch(Context::getLangType()) {
|
||||||
case "en" :
|
case 'en' :
|
||||||
case "es" :
|
case 'es' :
|
||||||
if($format == "Y-m-d") $format = "M d, Y";
|
if($format == 'Y-m-d') $format = 'M d, Y';
|
||||||
elseif($format == "Y-m-d H:i:s") $format = "M d, Y H:i:s";
|
elseif($format == 'Y-m-d H:i:s') $format = 'M d, Y H:i:s';
|
||||||
elseif($format == "Y-m-d H:i") $format = "M d, Y H:i";
|
elseif($format == 'Y-m-d H:i') $format = 'M d, Y H:i';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -293,7 +294,7 @@
|
||||||
$day = (int)substr($str,6,2);
|
$day = (int)substr($str,6,2);
|
||||||
return str_replace(
|
return str_replace(
|
||||||
array('Y','m','d','H','h','i','s','a','M', 'F'),
|
array('Y','m','d','H','h','i','s','a','M', 'F'),
|
||||||
array($year,$month,$day,$hour,$hour/12,$min,$sec,$hour<=12?'am':'pm',getMonthName($month), getMonthName($month,false)),
|
array($year,$month,$day,$hour,$hour/12,$min,$sec,($hour <= 12) ? 'am' : 'pm',getMonthName($month), getMonthName($month,false)),
|
||||||
$format
|
$format
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue