I have a simple News Alert CCK data type, which I've created a view for that generates a simple list for a sidebar block.
Currently it displays:
Performer of the Year first round auditions
7 hours ago
Alumni jazz combo opens benefit concert
5 days 1 hour ago
Enthusiastic response to the debut of Les Miserables
1 week 5 hours ago
I want it to display as:
Performer of the Year first round auditions
7 hours ago
Performer of the Year first round auditions
4 days ago
Alumni jazz combo opens benefit concert
5 days ago
Enthusiastic response to the debut of Les Miserables
1 week ago
In other words, if it's more than 24 hours ago, I don't want the hours to display. It's too much info and clutters the display. Anyone know how to do this?
There may be a way through the Views admin pages. There's an option box under Fields for date fields like the Node Creation, which I'm using, but I don't know what I'd put there to make it work, and I'm not sure this can handle logic like I need here.
I couldn't find a theme function to customize. In the date module there's just a '!time' variable that seems to put the time into the string, which is why I thought of using the option in views to modify this value.
Any help would be great.
Thanks
Comments
Good question, I wonder the
Good question, I wonder the same. How do you remove the 'seconds' if 23 min 44 sec.
Regards,
Czar
granularity
what you need is to set the granularity. just add '1' as option.
Just a quick note to say
Just a quick note to say THANK YOU - that was a massively helpful tip...
Granularity setting of "As Time Ago" format
Could you be more specific about how to set the granularity of the "As Time Ago" date format? I don't see anywhere to add '1' as an option. All I'm presented with is when editing a Content field containing a date is the four checkboxes (Exclude from display, Rewrite output of field, Output field as link, Trim this field..., and Link this field...), the set of Label radio buttons, and the Format drop down.
Cheers
Agreed, I do not see how to
Agreed, I do not see how to set granularity!
ping
ping
On Drupal 7.4, once you
On Drupal 7.4, once you select ‘Time Ago’ or ‘Time Ago (with "ago" appended)’, you'll get a ‘Custom date format’ field. Put the
1in that field.The help string for the field says so, but I missed it too in the beginning:
Where to set granularity in core
I couldn't find it in the Content Type pages or the Views so ended up finding this thread on how to make the modification in the core and in the date module:
http://drupal.org/node/358219
Far less than ideal, but I needed something that worked!
Big Thanks @rcombes
Awesome suggestion.
.
.
Adriadrop Drupal development