Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-07-31 01:57:26

frotzed
Member
From: Planet Earth
Registered: 2007-05-08
Posts: 20
Website

Can the date be displayed like this?

Right now on my site (http://openswitch.org) I’ve got this code to display each article’s posted date:

<txp:posted format=”%m<br />%d<br />%y” />

And it results in the date looking like this:

07
30
07

I like that, but what I’d REALLY like to do is get my date to look like this:

0
7
3
0
0
7

I assume I can’t do this with straight-up strftime formatting but is there any way to write a php script or something that could get the date to look like this?


Ben Gray | ben@openswitch.org | http://openswitch.org

Offline

#2 2007-07-31 09:03:47

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Can the date be displayed like this?

Something like this perhaps:

<txp:php>echo nl2br(chunk_split(posted(array('format' => '%m%d%y')), 1, "\n"));</txp:php>

Last edited by ruud (2007-07-31 12:55:40)

Offline

#3 2007-07-31 12:42:17

frotzed
Member
From: Planet Earth
Registered: 2007-05-08
Posts: 20
Website

Re: Can the date be displayed like this?

That doesn’t seem to work. The script looks good to me, but nothing displays when I put that snippet into my template.


Ben Gray | ben@openswitch.org | http://openswitch.org

Offline

#4 2007-07-31 12:55:48

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Can the date be displayed like this?

Oops. forgot the echo. Corrected in the code above.

Offline

#5 2007-07-31 13:38:43

frotzed
Member
From: Planet Earth
Registered: 2007-05-08
Posts: 20
Website

Re: Can the date be displayed like this?

Genius! I owe you big time! Thanks a ton!


Ben Gray | ben@openswitch.org | http://openswitch.org

Offline

Board footer

Powered by FluxBB