Test Footer

tanggal bulan tahun


function bln(){
    $bulan=array(
             '0'=>'-- Pilih --',
             '01' => 'January',
             '02' => 'Februari',
             '03' => 'Maret',
             '04' => 'April',
             '05' => 'Mei',
             '06' => 'Juni',
             '07' => 'July',
             '08' => 'Agustus',
             '09' => 'September',
             '10' => 'Oktober',
             '11' => 'November',
             '12' => 'Desember'

            
             );
    return $bulan;
}

function tgl(){
   
    for($i=1;$i<=31;$i++){
        $frm=str_pad($i,2,'0',STR_PAD_LEFT);
        $tgl[$frm]=$frm;
    }
    return $tgl;
}

function thn($awal="",$akhir=""){
    if($awal==''){
        $awal='2000';
    }
   
    if($akhir==''){
        $akhir=date('Y');
    }
   
    for($i=$awal;$i<=$akhir;$i++){
        $year[$i]=$i;
    }
   
    return $year;
}

function days_in_month($bln="",$thn=""){
    return cal_days_in_month(CAL_GREGORIAN, $bln, $thn);
}

function timeAgo

function timeAgo($time=""){
  $periods = array("detik", "menit", "jam", "hari", "minggu", "bulan", "tahun", "dekade");
   $lengths = array("60","60","24","7","4.35","12","10");

   $now = time();

       $difference     = $now - $time;
       $tense         = "yang lalu";

   for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
       $difference /= $lengths[$j];
   }

   $difference = round($difference);

   if($difference != 1) {
       $periods[$j].= "";
   }

   return $difference.' '.$periods[$j].' '.$tense;
}

Comment

Powered by Blogger.

Test Footer