Usage: time_of_day(abs(strtotime($post->post_date)));
Inputs are unix timestamps
Version: 1.0 beta
Author: Phu Ly & Dunstan Orchard & Michael Heilemann
Author URI: http://www.ifelse.co.uk
*/
// inputs must be unix timestamp (seconds)
function time_of_day($pdate){
global $wpdb, $tableposts;
$hour=date('H',$pdate);
switch($hour)
{
case 0:
case 1:
case 2:
$tod = 'the wee hours';
break;
case 3:
case 4:
case 5:
case 6:
$tod = 'terribly early in the morning';
break;
case 7:
case 8:
case 9:
$tod = 'early morning';
break;
case 10:
$tod = 'mid-morning';
break;
case 11:
$tod = 'late morning';
break;
case 12:
case 13:
$tod = 'lunch time';
break;
case 14:
$tod = 'early afternoon';
break;
case 15:
case 16:
$tod = 'mid-afternoon';
break;
case 17:
$tod = 'late afternoon';
break;
case 18:
case 19:
$tod = 'early evening';
break;
case 20:
case 21:
$tod = 'evening time';
break;
case 22:
$tod = 'late evening';
break;
case 23:
$tod = 'late at night';
break;
default:
$tod = '';
break;
}
//return $tod;
echo $tod;
}
?>