Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2018-02-08 12:41:50
- ibadullah
- Member
- From: Kabul, Afghanistan
- Registered: 2017-09-16
- Posts: 49
how to change before 24 hours date format ?
I want to change the date format of today’s article in since format and all other in a normal format, like:
if article posted <24 hours.
<txp:posted format=“since” />
else
<txp:posted />
Offline
Re: how to change before 24 hours date format ?
Maybe this kind of arrangement works:
<txp:php>
$posted = parse('<txp:posted format="%Y-%m-%d" />');
if (strtotime($posted) >= strtotime('24 hours ago')) {
echo parse('<txp:posted format="since" />');
}
else {
echo parse('<txp:posted format="%Y-%m-%d" />');
}
</txp:php>
Offline
Re: how to change before 24 hours date format ?
<txp:csb_if_newer_than hours="24">
<txp:posted format=“since” />
<txp:else />
<txp:posted />
</txp:csb_if_newer_than>
Offline