Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-02-19 15:56:44

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Time formats for various date tags

I wonder if someone can clarify this for me…

In the documentation, <txp:posted /> and <txp:modified /> tags format attribute states:

Values: any valid strftime() string values, since, iso8601, w3cdtf, or rfc822.

However on <txp:image_date />, <txp:file_download_created /> and <txp:file_download_modified /> it simply states:

Values: any valid strftime() string values.

And then, on <txp:link_date /> and <txp:comment_time /> we have:

Values: any valid strftime() string values, or since.

Finally <txp:search_result_date /> doesn’t allow for any specific date formats at all (I guess it just uses global pref)!

So, can I not use iso8601 on any of those at all (if so, that’s nuts), or is it just errors in the documentation?

Offline

#2 2015-02-19 16:24:09

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Time formats for various date tags

philwareham wrote #288421:

is it just errors in the documentation?

Yes. The code that handles date formatting is (as far as I can tell) the same for all tags, so you can use any of the formats you listed in any tags. Haven’t tried it in 4.5.x, but the tag handling code in this regard hasn’t changed much between that and 4.6.x.

And, despite not officially being documented as such, the <txp:search_result_date /> tag just hands off directly to <txp:posted />. So by default it uses whatever is set in your prefs as the date format, but you can override it with the format attribute and, indeed, any of the attributes that are acceptable for <txp:posted />.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2015-02-19 16:31:04

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Time formats for various date tags

Great, thanks Stef – so shall I update the Wiki documentation to reflect this?

Offline

#4 2015-02-19 16:37:33

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Time formats for various date tags

philwareham wrote #288423:

so shall I update the Wiki documentation to reflect this?

I suppose it makes sense, yeah, if you have time. I ran a few tests (as I said, under 4.6.x) so it might be prudent to check you can actually use all the format strings under 4.5.x. Can’t see any reason they wouldn’t work.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB