change date and time stamp on a per theme basis

2 views
Skip to first unread message

rikamus

unread,
Jun 12, 2008, 7:15:31 PM6/12/08
to habari-users
hello! i'm new to habari and, although i've dabbled a little bit here
and there, general web development stuff, so forgive me if this is
really obvious.
i did a quick search and couldn't find out how to change the date and
time stamp that habari gives posts. i assume it's something to do with
pubdate but i'm not sure how to change it just for a single theme. can
i add something to the theme.php file? if so, please could someone be
kind enough to tell me what?

thanks!

Andy C

unread,
Jun 12, 2008, 7:21:40 PM6/12/08
to habari-users
From system/themes/k2/theme.php

// Apply Format::nice_date() to post date...
Format::apply( 'nice_date', 'post_pubdate_out', 'F j, Y g:ia' );

HTH

Michael C. Harris

unread,
Jun 12, 2008, 7:28:31 PM6/12/08
to habari...@googlegroups.com
On Thu, Jun 12, 2008 at 04:21:40PM -0700, Andy Cowling wrote:
>
> From system/themes/k2/theme.php
>
> // Apply Format::nice_date() to post date...
> Format::apply( 'nice_date', 'post_pubdate_out', 'F j, Y g:ia' );

Just to add to Andy's note, this code snippet, which should go in your
theme.php, applies the nice_date function when echo $post->pubdate_out
is called in your template. The final string indicates how the date
will be formatted. See http://au2.php.net/date for a list of the
parameters that can be used here.

You can format dates differently with different hooks. For example, if
you want to format dates on comments you'd change 'post_pubdate_out'
to 'comment_date_out' (I think, I didn't look that hook up).

--
Michael C. Harris, School of CS&IT, RMIT University
http://twofishcreative.com/michael/blog

Andy C

unread,
Jun 12, 2008, 7:38:16 PM6/12/08
to habari-users
Oh and to add to Michael's note - if you want to convert UTC time to
your local timezone with automatic adjustment for DST, well I'm afraid
you're on your own :-)

Michael C. Harris

unread,
Jun 12, 2008, 8:04:09 PM6/12/08
to habari...@googlegroups.com

Well, not strictly on your own, you just have to be patient :)

rikamus

unread,
Jun 12, 2008, 8:07:08 PM6/12/08
to habari-users
fantastic! thanks for the swift replies guys. i'm off to try that now!
Reply all
Reply to author
Forward
0 new messages