XF 1.1 datetime format that is not ISO 8601

Brett Peters

Well-known member
I have been adding some rich snippets to XF and whilst using the rich snippet testing tool I get a warning that the datetime format that is not ISO 8601.

I should probably mention that I am using {xen:datetime $thread.post_date, html} for the date input just incase I am doing something that is incorrect.

Is ISO 8601 something that should be addressed or is it just not that important and it would be safe to ignore the error ?
 
If you need the date in a specific format, you should specify that in the second parameter (a la PHP date()).
Could you give an example, please?
I'm putting rich snippets into a template.
It needs to look like
HTML:
<meta itemprop="uploadDate" content="2015-02-05T08:00:00+08:00"/>
and the variable I have is $block.publish_date.
I tried
Code:
<meta itemprop="uploadDate" content="{xen:datetime $block.video_title, 'c'}"/>
and
Code:
<meta itemprop="uploadDate" content="{xen:datetime $block.video_title, c}"/>
But got an error
DateTime::setTimestamp() expects parameter 1 to be long, string given in /home/sites/avforums/public_html/library/XenForo/Locale.php, line 162
Thanks
 
Hey,
I also need that value and tried many things:
{xen:date $thread.post_date, c} returns c
and
{xen:datetime $thread.post_date, c}returns 6. Juli 2017 um 18:19 Uhr

Does anybody got a solution? :S
 
I was looking for an ISO 8601 date output (without time) of a unixtime variable.

As mentioned by Stuart Wright and bAstimc, the following two do not work:
{xen:date $unixtime, 'c'} returns 'c'.
{xen:datetime $unixtime, 'c'} returns a localized datetime string '26. Januar 2019 um 11:00 Uhr'.

This one works (inspired by https://xenforo.com/community/threa...ing-schema-implementation.131979/post-1164439):
{xen:date $unixtime, 'Y-m-d'} returns '2019-01-26'.
 
Top Bottom