Friendly Time Plugin

    5 January 2005, late evening

I’ve written plugin implements the idea discussed by Dunstan on his personal blog about displaying the time a post was published in a friendly manner. Simply place the <txp:rsx_time_of_day /> tag in an article template form and it will print out the time in a friendlier manner. For example, 12:00 will get turned into “lunch time”. I’ve basically copied his code verbatim. You can go and change what is output by editing the switch statement.

Download the plugin: rsx_time_of_day.txt

update: Bug Fix, $timeoffset was not declared as a global variable.

 

Comments

  1. “You da man!”

  2. Thanks again for implementing this :)

    Jay

  3. I have implemented your plug-in in my website, altough I translated the strings to Spanish. Dates look more “human” now, thank you very much!

  4. Hi ya. I’m having a slight problem with this plug-in. It doesn’t seem to be picking up the timeoffset figure. I have just made a new post at 7:30am but it is showing “late at night”. I have a +8 hour differential to my host’s timezone. I’m currently running TXP 1.0RC2 changeset 46. Any ideas?

  5. I do add the timeoffset when calculating the time. The value/variable may have changed in the latest TXP release. I’ll look into it after work today.

  6. Yes I can see it in the code. Thanks for looking. I’ll check back later.

  7. Hi again :)
    After updating my system to RC3 I also have the same problem as Stuart, but don’t know how to solve it. Any advice?
    Thanks!

  8. Multiverso, if you could try changing the name of the variable timeoffset to gmtoffset, I think things should work once more. I don’t have an RC3 install I can test with. Please let me know if this solves your problem.

  9. Yes, I changed the variable and it’s working now. Thanks!

Don't be shy, you can comment too!

 
Some things to keep in mind: You can style comments using Textile. In particular, *text* will get turned into text and _text_ will get turned into text. You can post a link using the command "linktext":link, so something like "google":http://www.google.com will get turned in to google. I may erase off-topic comments, or edit poorly formatted comments; I do this very rarely.