EE: Nice Date plugin
Low Nice Date is an ExpressionEngine plugin takes a certain date and format and outputs the given date in the given format, localized or not. This post now provides a place for support for the Low Nice Date plugin.
Download and docs for Low Nice Date can be found in the Software section
Comments
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.
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.
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?
Yes, you need to edit the
mod.comment.phpfile.Sers Low,
one question… what do i have to edit in the
mod.comment.php? Can you tell us? ;)Steffen, a hack is no longer needed, since EE 1.6 now supports the url_title parameter in said tags!
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
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.
Thanks Low. I got it. I just had my segments in the wrong order.
hi low,
I’m having some problems with your plugin. this code isn’t working for me:
{exp:nice_date date=”{exp:truncate max=”11″ rep=” “}{cat_folder}{/exp:truncate}” format=”%F %j%S, %Y” localize=”yes”}
the cat_folder is a variable of which the first 11 chars consist of a date. example: “2008-05-30 Superglue @ Fuse, Brussels” is truncated to “2008-05-30″. but there is no output whatsoever. is there a solution that allows me to keep the truncate functionality?
I’m afraid you can’t use another plugin tag as parameter input, bob. In this case, you’d probably have to use php instead of the truncate plugin to get the substring you need.
Is there a way of only having the first 3 letters of the month such as Jun, Mar or Sep?
There is, Steven. As long as the
dateattribute contains a complete date, you can format it any way you want. So, in the second example, you could useformat="%M"to get your result.Can you give me an example? I’m not quite following how this works…
I understand what you mean now. I should get some sleep :)
Great plugin, did just what I needed. Thanks muchly.
Hi Low,
I have the following code -
{exp:nice_date date="{entry_date format="%Y-%m-%d-%g-%i"}" format="%j%S %F %Y - %g:%i%a" localize="yes"}My entry time is 2:30pm but the output says 2:00pm. Any ideas?
Hey steve. Try this:
{exp:nice_date date="{entry_date format="%Y-%m-%d %H:%i"}" format="%j%S %F %Y - %g:%i%a" localize="yes"}Or this:
{entry_date format="%j%S %F %Y - %g:%i%a"}:)Hi Lodewijk.
Good to be back again on your website.
I’m looking for a date plugin that converts a date/time to
5 hours ago
1 hour ago
32 minutes ago
But when it’s more than 36 hours ago, then the date should be May 15th, 2009 (without a timestamp).
Hey Erwin. There is no single plugin that does that at the moment. You’ll have to use a combination of the Relative Date plugin and PHP on output, I think.
Or, just use the relative date variable and some conditionals, perhaps?
I was actually waiting for a guy from Holland writing this plugin :-)
Any chance there is a way to get this to output French months.
oh nevermind. lol. conditional statements are awesome.