XF 2.2 Showing ISO 8601 date/time in template

Soyuz_new

Member
Hello,

I'm composing a new template and I need the raw, non-formatted date/time information. If I use this...

Code:
<xf:date time="{$thread.first_post_date}" />

...it shows something like...

Code:
<time  class="u-dt" dir="auto" datetime="2022-12-13T09:55:27+0100" data-time="1670921727" data-date-string="13 Dic 2022" data-time-string="09:55" title="13 Dic 2022 a las 09:55">Today at 09:55</time>

But I only need "2022-12-13T09:55:27". Is there a template variable/code to get only that?

Thank you!
 
You can use date_time {{ date_time($thread.first_post_date) }}


I'm sorry, I've noticed the right getter is post_date, not first_post _date. Anyway, if I use your solution, it gives a "natural" date, like "13 Dic 2022 at 09:55". What I need is a date/time in a suitable format for s chema markup, just like 2022-12-13T09:55:27
 
I'm sorry, I've noticed the right getter is post_date, not first_post _date. Anyway, if I use your solution, it gives a "natural" date, like "13 Dic 2022 at 09:55". What I need is a date/time in a suitable format for s chema markup, just like 2022-12-13T09:55:27
try {{ date($timestamp, $dateFormat) }}
 
Top Bottom