php取數(shù)據(jù)庫日期
```php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
// 創(chuàng)建連接
$conn = new mysqli($servername, $username, $password, $dbname);
// 檢測連接
if ($conn->connect_error) {
die("連接失敗: " . $conn->connect_error);
}
$sql = "SELECT date_column FROM myTable WHERE condition...";
$result = $conn->query($sql);
if ($result->num_rows > ) {
// 輸出每行數(shù)據(jù)
while($row = $result->fetch_assoc()) {
echo "date: " . $row["date_column"]. "
";
}
} else {
echo " 結果";
}
$conn->close();
?>
```
在此代碼中,"date_column"是你要從中獲取日期的數(shù)據(jù)庫列的名字,而"myTable"則是包含該列的表的名字。你根據(jù)實際情況修改這些值。