본문 바로가기

프로그래밍/PHP

PHP 날짜형식 DATA ATOM

반응형

2020-07-03T02:08:40+09:00

php DATE ATOM

날짜형식 T +09:00 형태

 

$time = new DateTime;

echo $time->format(DateTime::ATOM);

 
echo $x = date(DATE_ATOM, mktime(01, 00, 00, 7, 1, 2017)); //2017-07-01T10:20:30+09:00

 

 

$today_date = '2009-09-30 20:24:00';

echo '오늘: ' . $today_date; 

$today_date = date(DATE_ATOM, strtotime($today_date . ' +1 day'));

echo '오늘 + 1 day: ' . $today_date;

 

 

For PHP 5.2.0+, you may also do as follows:

 

$today_date = new DateTime('2009-09-30 20:24:00');

echo '오늘: ' . $today_date->format('Y-m-d H:i:s'); 

$today_date->modify('+1 day');

echo '오늘 + 1 day: ' . $today_date->format('Y-m-d H:i:s');

 

//ATOM 형식

echo date("Y-m-d\TH:i:s+09:00", time());

반응형