Index: plugins/content_types/node_context/node_created.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ctools/plugins/content_types/node_context/node_created.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 node_created.inc
--- plugins/content_types/node_context/node_created.inc	29 Jan 2010 20:18:25 -0000	1.1.2.1
+++ plugins/content_types/node_context/node_created.inc	20 Apr 2010 09:24:08 -0000
@@ -14,6 +14,7 @@ $plugin = array(
   'category' => t('Node'),
   'defaults' => array(
     'format' => 'small',
+    'custom_date_format' => NULL,
   ),
 );
 
@@ -27,12 +28,39 @@ function ctools_node_created_content_typ
 
   // Get a shortcut to the node.
   $node = $context->data;
+  $time_diff = time() - $node->created; // will be positive for a datetime in the past (ago), and negative for a datetime in the future (hence)
+
+  // format the date
+  $format = $conf['format'];
+  if (in_array($format, array('custom', 'raw time ago', 'time ago', 'raw time span', 'time span'))) {
+    $custom_format = $conf['custom_date_format'];
+  }
+
+  switch ($format) {
+    case 'raw time ago':
+      $formatted_date = format_interval($time_diff, is_numeric($custom_format) ? $custom_format : 2);
+      break;
+    case 'time ago':
+      $formatted_date = t('%time ago', array('%time' => format_interval($time_diff, is_numeric($custom_format) ? $custom_format : 2)));
+      break;
+    case 'raw time span':
+      $formatted_date = ($time_diff < 0 ? '-' : '') . format_interval(abs($time_diff), is_numeric($custom_format) ? $custom_format : 2);
+      break;
+    case 'time span':
+      $formatted_date = t(($time_diff < 0 ? '%time hence' : '%time ago'), array('%time' => format_interval(abs($time_diff), is_numeric($custom_format) ? $custom_format : 2)));
+      break;
+    case 'custom':
+      $formatted_date = format_date($node->created, $format, $custom_format);
+      break;
+    default:
+      $formatted_date = format_date($node->created, $format);
+  }
 
   // Build the content type block.
   $block = new stdClass();
   $block->module  = 'node_created';
   $block->title   = t('Created date');
-  $block->content = format_date($node->created, $conf['format']);
+  $block->content = $formatted_date;
   $block->delta   = $node->nid;
 
   return $block;
@@ -46,15 +74,29 @@ function ctools_node_created_content_typ
 
   $time = time();
   $form['format'] = array(
-    '#title' => t('Date format'),
     '#type' => 'select',
+    '#title' => t('Date format'),
     '#options' => array(
       'small' => format_date($time, 'small'),
       'medium' => format_date($time, 'medium'),
       'large' => format_date($time, 'large'),
+      'custom' => t('Custom'),
+      'raw time ago' => t('Time ago'),
+      'time ago' => t('Time ago (with "ago" appended)'),
+      'raw time span' => t('Time span (future dates start with - )'),
+      'time span' => t('Time span (with "ago/hence" appended)'),
     ),
     '#default_value' => $conf['format'],
   );
+
+  $form['custom_date_format'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Custom date format'),
+    '#description' => t('If "Custom", see <a href="http://us.php.net/manual/en/function.date.php" target="_blank">the PHP docs</a> for date formats. If "Time ago" this is the the number of different units to display, which defaults to two.'),
+    '#default_value' => $conf['custom_date_format'],
+    '#process' => array('ctools_dependent_process'),
+    '#dependency' => array('edit-format' => array('custom', 'raw time ago', 'time ago', 'raw time span', 'time span')),
+  );
 }
 
 /**
Index: plugins/content_types/node_context/node_updated.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ctools/plugins/content_types/node_context/node_updated.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 node_updated.inc
--- plugins/content_types/node_context/node_updated.inc	29 Jan 2010 20:18:25 -0000	1.1.2.1
+++ plugins/content_types/node_context/node_updated.inc	20 Apr 2010 09:24:08 -0000
@@ -14,6 +14,7 @@ $plugin = array(
   'category' => t('Node'),
   'defaults' => array(
     'format' => 'small',
+    'custom_date_format' => NULL,
   ),
 );
 
@@ -27,12 +28,41 @@ function ctools_node_updated_content_typ
 
   // Get a shortcut to the node.
   $node = $context->data;
+  $time_updated = (!empty($node->updated)) ? $node->updated : $node->created;
+  $time_diff = time() - $time_updated; // will be positive for a datetime in the past (ago), and negative for a datetime in the future (hence)
+
+	// format the date
+	$format = $conf['format'];
+	if (in_array($format, array('custom', 'raw time ago', 'time ago', 'raw time span', 'time span'))) {
+	  $custom_format = $conf['custom_date_format'];
+	}
+
+	switch ($format) {
+	  case 'raw time ago':
+	    $formatted_date = format_interval($time_diff, is_numeric($custom_format) ? $custom_format : 2);
+	    break;
+	  case 'time ago':
+	    $formatted_date = t('%time ago', array('%time' => format_interval($time_diff, is_numeric($custom_format) ? $custom_format : 2)));
+	    break;
+	  case 'raw time span':
+	    $formatted_date = ($time_diff < 0 ? '-' : '') . format_interval(abs($time_diff), is_numeric($custom_format) ? $custom_format : 2);
+	    break;
+	  case 'time span':
+	    $formatted_date = t(($time_diff < 0 ? '%time hence' : '%time ago'), array('%time' => format_interval(abs($time_diff), is_numeric($custom_format) ? $custom_format : 2)));
+	    break;
+	  case 'custom':
+	    $formatted_date = format_date($time_updated, $format, $custom_format);
+	    break;
+	  default:
+	    $formatted_date = format_date($time_updated, $format);
+	}
+
 
   // Build the content type block.
   $block = new stdClass();
   $block->module  = 'node_updated';
   $block->title   = t('Last updated date');
-  $block->content = format_date(!empty($node->updated) ? $node->updated : $node->created, $conf['format']);
+  $block->content = $formatted_date;
   $block->delta   = $node->nid;
 
   return $block;
@@ -46,15 +76,30 @@ function ctools_node_updated_content_typ
 
   $time = time();
   $form['format'] = array(
-    '#title' => t('Date format'),
     '#type' => 'select',
+    '#title' => t('Date format'),
     '#options' => array(
       'small' => format_date($time, 'small'),
       'medium' => format_date($time, 'medium'),
       'large' => format_date($time, 'large'),
+      'custom' => t('Custom'),
+      'raw time ago' => t('Time ago'),
+      'time ago' => t('Time ago (with "ago" appended)'),
+      'raw time span' => t('Time span (future dates start with - )'),
+      'time span' => t('Time span (with "ago/hence" appended)'),
     ),
     '#default_value' => $conf['format'],
   );
+
+  $form['custom_date_format'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Custom date format'),
+    '#description' => t('If "Custom", see <a href="http://us.php.net/manual/en/function.date.php" target="_blank">the PHP docs</a> for date formats. If "Time ago" this is the the number of different units to display, which defaults to two.'),
+    '#default_value' => $conf['custom_date_format'],
+    '#process' => array('ctools_dependent_process'),
+    '#dependency' => array('edit-format' => array('custom', 'raw time ago', 'time ago', 'raw time span', 'time span')),
+  );
+
 }
 
 /**
