<?php
$con=mysqli_connect("localhost","*********","***********","loadtracker");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT Date FROM pallettracker GROUP BY Date");
$DateList = mysqli_fetch_array($result);
$ListOfMonths=array('Dec','Nov','Oct','Sep','Aug','Jul','Jun','May','Apr','Mar','Feb','Jan');$ListOfDays = array('31','30','29','28','27','26','25','24','23','22','21','20','19','18','17','16','15','14','13','12','11','10','9','8','7','6','5','4','3','2','1');
foreach ($ListOfDays as $value) {
foreach ($ListOfMonths as $value2) {
$Yaer = array("'$value2' + '$value' + ',2013'");
foreach ($Yaer as $yaerdate) {
foreach ($DateList as $Dates) {
if ($yaerdate == $Dates)
{
echo $yaerdate;
echo '/';
}
}
}
}
}
?>
試圖訂購日期爲2011年1月28日的日期陣列和Decending。然後顯示然後與他們之間的/中間。對於Android應用程序訂購日期列表
的最佳方式訂購日期是YYYYMMDD。您應該使用此格式對它們進行排序並使用簡單的方法將其轉換爲您所需的樣式。 – Rob013