2010-11-19 9 views
4

Tue Oct 26 10:39:39 +0000 2010PHP 날짜 형식

날짜 시간 개체를 사용 2010-10-26

+0

첫 번째 줄을 출력하는 데 사용되는 코드는 무엇입니까? – Ben

답변

8
echo date('Y-m-d', strtotime("Tue Oct 26 10:39:39 +0000 2010")) 
// 2010-10-26 
+0

'strtotime()'좋은 정보. – Ben

0
echo date('Y-m-d'); 
0

에 형식을 변환하는 방법 :

echo date_format(new DateTime('Tue Oct 26 10:39:39 +0000 2010'), 'Y-m-d'); 

나 :

$date = new DateTime('Tue Oct 26 10:39:39 +0000 2010'); 
echo $date->format('Y-m-d');