Selisih jam awal dan akhir
$skrg = mktime(date("H")-1,date("i"),date("s"),date("m"),date("j"),date("Y"));
$tglAwal=date("Y-m-j H:i:s", $skrg);$tglAkhir = "2010-05-26 00:00:00";
mysql_connect("localhost","root","pass");
mysql_select_db("tokobukudb");$query = "SELECT timediff('$tglAkhir', '$tglAwal') as selisih";
$hasil = mysql_query($query);
$data = mysql_fetch_array($hasil);
$selisih=$data['selisih'];
$jam=substr($selisih,0,2);
$mnt=substr($selisih,3,2);
$dtk=substr($selisih,6,2);
if ($dtk==59)
{
echo " Malam ";
}
else {
echo "Selisih antara jam ".$tglAwal."";
echo "sampai dengan jam “.$tglAkhir.” adalah “.$data['selisih'].” menit”;
echo “
selisih : $selisih”;
echo “
“.$jam.” jam “.$mnt.” menit “.$dtk.” detik “;
echo “” ;
}
?>
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically each day to your feed reader.
Trackbacks & Pingbacks
Comments
Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>





Manteps… makasih pa ilmunya … salam kenal