문제

I am trying to format last modified timestamp for all pages, but need to get it in specific format.

This is how it should look: 2014-04-26T15:58:45+00:00, but all my attempts are either ended with error or just like that 2014-04-28 13:41:49

here is my variable date($info['sitemap_last_modified']);

I was also trying to use the following date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000));, but I do not know where to place the following $info['sitemap_last_modified']

Please help me

도움이 되었습니까?

해결책

Just use the c modifier for the PHP date() function.

// Assuming $info['sitemap_last_modified'] is in a 
// standard format strtotime() can parse
// http://www.php.net/manual/en/datetime.formats.php
echo date('c', strtotime($info['sitemap_last_modified']));
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top