PHP FUNCTION AM. PM

 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 오후

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다