Google Sitemap Date Format

前端 未结 10 1742
情书的邮戳
情书的邮戳 2021-02-12 09:35

I need date format for sitemaps in php.

How can i do that ?

Is this output right ?

2012-08-02EEST18:01:18+03:00
         


        
10条回答
  •  走了就别回头了
    2021-02-12 10:22

    Your getting this output because you used the old recommended timestamp string of

    Y-m-dTH:i:sP.
    

    However, what you need is

    Y-m-d\TH:i:sP
    

    This single back slash will make the difference. At some point a capital T became a special character in PHP signifying timecode, so if you don't escape the T you will get exactly what your reporting.

提交回复
热议问题