리눅스 개발/PHP게시판 및 소스

PHP 날짜를 숫자로 숫자를 날짜로 변환

꿈꾸는새벽별 2023. 9. 26. 15:24

일단 소스를 보자.

$today= date("Y-m-d H:i:s"); 
echo "오늘 날짜 :".$today.""; 

$strt= strtotime($today); 

echo "오늘 날짜(Y-m-d H:i:s)를 숫자형으로 : ".$strt."";   

echo "시작  날짜 : ".date("Y-m-d H:i:s","1973862000").""; 

echo "마지막날짜 : ".date("Y-m-d H:i:s","1446625932").""; 

echo ""; 
echo "========================================================";  

$s_start = "2032-07-20 00:00:00"; 
$s_end = "2012-07-21 23:59:59"; 
$strt_start= strtotime($s_start); $strt_end= strtotime($s_end);  

echo "시작  날짜 : ".$s_start." : 숫자형 :".$strt_start.""; 
echo "마지막날짜 : ".$s_end."   : 숫자형 :".$strt_end."";  

echo "=========================================================";   

//$start_day = mktime( 0, 0, 0, $_POST[start_mon], $_POST[start_day], $_POST[start_year] ); 
$start_day = mktime( 23, 15, 33, "09", "25", "2012" );  
echo "mktime함수:".$start_day."" ; 

echo "date함수로 복원 : ".date("Y-m-d H:i:s",$start_day)."" ;  

echo "";  

echo "---------------------------------------------";    

function mm(){          
	echo "홍길동";	 
}  

function aa($_value){      
	$aa = $_value;          
    return $aa;			               
}  
echo aa(mm());