How can I reduce the granularity of login time ago in Views (from minutes to days)? I have a view of users which displays fields, one of which is User: Last login.  I set the Date format to Time ago (with "ago" appended). By default, this returns values like:


1 hour 5 minutes ago
7 hours 23 minutes ago
3 days 17 hours ago


I am sorting the view by User: Last login as well, and for this I have set the Granularity to Day.  For a number of reasons, I would like to prevent users from seeing precisely how long ago another user logged in if that user logged in within the last 24 hours.  So instead, I would like to return values like:


1 hour 5 minutes ago-> Today
7 hours 23 minutes ago-> Today
3 days 17 hours ago-> 3 days ago


Is it possible to do something like this as a custom Date format in Views?
In the "dull ax" approach to things, you could do a combination of things here.


In the Views UI, under the Date Format, there is a If "Custom", see the PHP docs for date formats. If "Time ago", enter the number of different time units to display, which defaults to 2. Set this to 1.
Now, Views will only output 13 sec ago 13 min ago 1 hour ago etc instead of 1 day 13 hours etc.
This still doesn't get rid of your specificity of the time of the day if today, eg it is going to output 1 sec ago, 12 min ago or 3 hour ago, etc.
To take care of that, you can create a views template for that field, eg, here in D6 World it would be something like views-view-field--NAMEOFVIEW--login.tpl.php.
In there, do something along the lines of:


if (strpos($output, 'sec') !== FALSE || strpos($output, 'min') !== FALSE || strpos($output, 'hour') !== FALSE) {
  print t('Today');
}
else {
  print $output;
}

which will print out Today if it sees a sec, min or hour, or the default if not, eg, it sees day, week, month etc.