Drupal has a nice little function called format_interval that formats a time interval in a “x secs ago” fashion. Note that it accepts a time interval, not an absolute time value, thus you need to subtract the time value from time().
For example, to print your node’s created time, use:
<?php echo 'Submitted ',format_interval(time()-$node->created),' ago'; ?>