<?php if (empty($_POST)) { ?> <form id="form1" name="form1" method="post" action=""> <input type="text" name="txt" id="txt" /> <input type="submit" name="button" id="button" value="Submit" /> </form> <?php } else { ?> <?php function ConvertMinutes2Hours($Minutes) { if ($Minutes < 0) { $Min = Abs($Minutes); } else { $Min = $Minutes; } $iHours = Floor($Min / 60); $Minutes = ($Min - ($iHours * 60)) / 100; $tHours = $iHours + $Minutes; if ($Minutes < 0) { $tHours = $tHours * (-1); } $aHours = explode(".", $tHours); $iHours = $aHours[0]; if (empty($aHours[1])) { $aHours[1] = "00"; } $Minutes = $aHours[1]; if (strlen($Minutes) < 2) { $Minutes = $Minutes ."0"; } $tHours = $iHours .":". $Minutes; return $tHours; } //Test Code $minute = $_POST['txt'] * 60; echo ConvertMinutes2Hours($minute); // This should print 3:40 ?> <?php } ?>
<?php echo compared_time(1.5); function compared_time($dec_time){ if(strpos($dec_time,".")!=""){ $tmp=explode(".",$dec_time); $hour=$tmp[0]; $dec_min=$dec_time-$hour; }else{ $hour=$dec_time; $dec_min=0; } $min=$dec_min*60; return $hour." ชั่วโมง ".$min." นาที"; } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง