Use Timeago date format for less than 24h ago only I would like to use the Timeago module as a date format. However, when the time ago has exceeded 24h, I would like it to show another format (e.g. 4 Feb, 2013) much like Twitter or Dribbble use.

I tried to tweak the code, but my skills let me down :/

Is there possibly a better module for this cause? Or do I have to make my own?

I found this code that shows how I want it to work, however I have no idea how to implement this to drupal.

Any help is appreciated, thanks.
Do users really sit on a page for a long enough time, that these dates need to be updated via javascript? Most of them will click on something and end up reloading the whole page at some point. So perhaps, a php solution is an option too?  

You could achieve the php solution by using the Custom Formatters module.

If you create a new php type custom formatter, with the following code (make sure it's a datestamp type):

$element = array();
foreach ($variables['#items'] as $delta =&gt; $item) {
  $unixstamp = $item['value'];
  $time_since = mktime() - $unixstamp;
  if ($time_since &lt; 86400) {
    $date_str = format_interval($time_since);
  }
  else {
    $date_str = format_date($unixstamp, 'custom', 'jS F Y');
  }

  $element[$delta] = array(
    '#type' =&gt; 'markup',
    '#markup' =&gt; $date_str,
  );
}
return $element;


When creating the formatter, make sure you select field type 'datestamp'. Once the formatter is created, then in the manage display tab of your content type, set the field to use this formatter.

If you don't have your date stored as a separate field, you might be able to apply the custom formatter to the node modified time, by installing the Display Suite module.

If you don't want to use any of these modules but want to hack some php into your theme or something, you can still use the same logic above with format_interval and format_date functions.

Hope that can help.