How to properly format last modified (lastmod) time for xml sitemaps

后端 未结 6 470
礼貌的吻别
礼貌的吻别 2021-02-05 05:37

I am creating an app that will automatically update sitemap.xml each time new content is added to, or updated on the site.

According to Google\'s best pract

6条回答
  •  鱼传尺愫
    2021-02-05 06:26

    Date.prototype.toISOString()

    The toISOString() method returns a string in simplified extended ISO format (ISO 8601), which is always 24 or 27 characters long (YYYY-MM-DDTHH:mm:ss.sssZ or ±YYYYYY-MM-DDTHH:mm:ss.sssZ, respectively). The timezone is always zero UTC offset, as denoted by the suffix "Z".

    // expected output: 2011-10-05T14:48:00.000Z

提交回复
热议问题