EE: Nice Date plugin

This ExpressionEngine plugin takes a certain date and format and outputs the given date in the given format, localized or not. This is particularly useful when you use dates in the url and you don’t want to use a {exp:weblog:entries} tag to display it in a nice way. Go on, have a Nice Date.

→ Download the Nice Date plugin, version 1.0

Parameters

Examples

{exp:nice_date date="2007-05-20" format="%F %j%S, %Y" localize="yes"}

This will output something like May 20th, 2007.

{exp:nice_date date="{segment_3}-{segment_4}-01" format="%F %Y"}

For a url like http://www.domain.com/index.php/blog/archive/2007/05/, this will output May 2007.

Comments

  1. author
    1 Dan 12 mei 2007, 17:49

    How do you set the date in the url using expression engine? I noticed that your archives, you have the dates in the url, nice.

  2. author
    2 Low 13 mei 2007, 13:55

    Dan, I use urls like this:
    {path=archive}{entry_date format="%Y/%m/%d/"}{url_title}/

    Then I use the url_title segment to fetch the right entry. But you need 2 hacks to display the comments and comment form, though.

  3. author
    3 Dan 17 mei 2007, 07:18

    Thanks. I ran across your post on the EE forums titled “url_title parameter in comment module.” I think it’s a good idea. When you say hack, does that mean into the core?

  4. author
    4 Low 22 mei 2007, 15:51

    Yes, you need to edit the mod.comment.php file.

  5. author
    5 Steffen 11 juli 2007, 09:59

    Sers Low,

    one question… what do i have to edit in the mod.comment.php? Can you tell us? ;)

  6. author
    6 Low 13 juli 2007, 17:01

    Steffen, a hack is no longer needed, since EE 1.6 now supports the url_title parameter in said tags!

  7. author
    7 fodney 2 oktober 2007, 21:40

    I’m getting some strange results. Using:

    {exp:nice_date date=”{segment_3} {segment_2}” format=”%F %Y”}

    http://www.sturgislibrary.org/calendar/2008/04/

    I get December 1969

    Should get April 2008

    Ideas?

    Thanks

  8. author
    8 Low 2 oktober 2007, 21:48

    fodney, try making an unambiguous date as input, for example: {exp:nice_date date="15-{segment_3}-{segment_2}" format="%F %Y"}

    Like this, the php function strtotime, used by this plugin, will recognize the date you’re trying to format.

  9. author
    9 fodney 3 oktober 2007, 14:24

    Thanks Low. I got it. I just had my segments in the wrong order.

Leave a comment

Some html (a, em, strong, etc) allowed.


Zoeken in loweblog.com