|
|
|
สอบถามโค้ดเวลาข้ามช่วง 12.00-13.00 รบกวนผู้รู้หน่อยครับ เริ่มเวลาจาก 08:30 |
|
|
|
|
|
|
|
เริ่มเวลาจาก 08:30
Code (PHP)
$date2 = $date; // $date = date("H:i");
$no = 0;
while ($Result = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
$no = $no + 1;
for ($r = 0; $r < count($Result["orderde_amount"]); $r++) {
$timeamount = $Result["orderde_amount"] * $Result["Pro_time"] / 60;
$timeamount = ceil($timeamount);
//echo $ASS;
if ($timeamount < 60) {
$hour = intval($timeamount / 60);
$minute = $timeamount % 60;
//echo $minute;
if ($minute != 0) {
$length1 = strlen($minute);
if ($length1 == '1') {
$hour = str_pad($hour, 2, "0", STR_PAD_LEFT);
$minute = str_pad($minute, 2, "0", STR_PAD_LEFT);
$echo = $hour . ":" . $minute;
} else {
$hour2 = str_pad($hour, 2, "0", STR_PAD_LEFT);
$echo = $hour2 . ":" . $minute;
}
} else {
$echo = $hour . ":" . $minute;
}
} elseif ($timeamount >= 60) {
$hour = intval($timeamount / 60);
$minute = $timeamount % 60;
if ($minute != 0) {
$length2 = strlen($minute);
if ($length2 == '1') {
$hour = str_pad($hour, 2, "0", STR_PAD_LEFT);
$minute = str_pad($minute, 2, "0", STR_PAD_LEFT);
$echo = $hour . ":" . $minute;
} else {
$hour = str_pad($hour, 2, "0", STR_PAD_LEFT);
$minute = str_pad($minute, 2, "0", STR_PAD_LEFT);
$echo = $hour2 . ":" . $minute;
}
} else {
$hour = str_pad($hour, 2, "0", STR_PAD_LEFT);
$minute = str_pad($minute, 2, "0", STR_PAD_LEFT);
$echo = $hour . ":" . $minute;
}
}
for ($r = 0; $r < count($Result["orderde_amount"]); $r++) {
$starthour = substr($date2, 0, 2);
$startminute = substr($date2, 3, 2);
$timehour = substr($echo, 0, 2);
$timeminute = substr($echo, 3, 2);
$timeforhour = $starthour + $timehour;
$timeforminute = $startminute + $timeminute;
if ($timeforminute >= 60) {
$timeforminute = $timeforminute - 60;
$timeforminute = str_pad($timeforminute, 2, "0", STR_PAD_LEFT);
$timeforhour = $timeforhour + 1;
$timeforhour = str_pad($timeforhour, 2, "0", STR_PAD_LEFT);
$date2 = $timeforhour . ":" . $timeforminute;
} elseif ($timeforminute < 60) {
$timeforminute = str_pad($timeforminute, 2, "0", STR_PAD_LEFT);
$timeforhour = str_pad($timeforhour, 2, "0", STR_PAD_LEFT);
$date2 = $timeforhour . ":" . $timeforminute;
}
}
}
Tag : PHP
|
ประวัติการแก้ไข 2017-08-18 16:47:54
|
|
|
|
|
Date :
2017-08-18 16:47:14 |
By :
1341922845927942 |
View :
715 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คำถามไม่เคลียร์ ต้องการทำอะไร ต้องให้คนช่วยแกะโค๊ดเองเลยเหรอ
งานนี้มันงานของใครกันแน่ ควรจะอธิบายให้มันชัดเจน
เพื่อคนที่จะช่วยเขาจะได้ช่วยได้ง่ายๆ มาแบบนี้แล้วใครจะช่วยล่ะครับ
จ้างเขาทำยังจะดีกว่า
|
|
|
|
|
Date :
2017-08-19 21:12:00 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ทำต่อไป
|
|
|
|
|
Date :
2017-08-22 13:30:08 |
By :
apisitp |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|