Changing the Date and Time Format, Simplified

Mar 12, 2007 12:58

Not to step on nimoloth's similar post, but I've always thought that the date and time printing function could be simplified a bit. So, here is my take on it, which I'm sure could be streamlined a little more.
To use, create a custom theme layer if you don't already have one, then copy in this code and change the blue variables to suit your customization ( Read more... )

how to:instructions, entries:timestamp, s2:theme layer, !tutorial, $acct level:paid or perm

Leave a comment

Comments 8

alexandramuses July 13 2007, 11:43:53 UTC
Thanks, this really helps! One question, though: I see that there's the option to have just the date show, not the time. How do I implement this through my theme layer? (I'm not using the Customization Wizard.) I looked through the layer source but couldn't find a likely-looking property to set.

Reply

av8rmike July 13 2007, 12:48:42 UTC
Look at the functions that call this one, which are print_entry() and print_comment(). This function just prints whatever is asked for based on the booleans in the arguments, so change the fourth one from "true" to "false" wherever you want to disable printing the time. It's probably something that should be controlled with properties, but that wasn't up to me.

Reply

alexandramuses July 13 2007, 15:20:05 UTC
Yeah, that'd work. Thanks a million!

Alternately, I could just change the lang_posted_by_date_and_time function so that it simply doesn't print the time.

Reply

av8rmike July 13 2007, 16:12:40 UTC
I suppose so, if you didn't care about having the time printed in comments, too. =P

Reply


atlantel October 13 2007, 11:34:14 UTC
I'm very interested by this customization, but what do I have to do to have a time marked as, for instance, 22:50 instead of 10:50PM. I don't know what to write in the blue lines...

Thanks for your help

Reply

av8rmike October 13 2007, 13:55:45 UTC
There's a link to the S2 docs at the end of the post that lists all of the different variables that are available. There's also one here in s2howto.

Reply

atlantel October 13 2007, 14:28:06 UTC
thank you, I did read the end of your post, but I didn't understand it, however, the link you gave me was so much clearer for someone like me who is computer illeterate!

Reply

av8rmike October 13 2007, 15:22:12 UTC
No problem. I edited the original instructions as well.

Reply


Leave a comment

Up