function ampm($time_sec)
{
$PM_START = 12 * 3600 ;
$AM_START = 24 * 3600 ;
if( $time_sec <= ( $PM_START - 1 ) )
{
$str = "오전";
}
else if ( $time_sec >= $PM_START )
{
if( $time_sec >= $AM_START )
{
$str = "오전";
}
else
{
$str = "오후";
}
}
return $str ;
}
<?=ampm(초)?>
// 오전 or 오후