我在我的mysql中有30-03-2015日期字段db.Im在csv文件中獲取數據庫中的日期,但如何從數據庫如何使用mysql查詢將正常日期替換爲csv文件中的unix日期
<?php
date_default_timezone_set('UTC');
$servername = "localhost";
$username = "testuser";
$password = "";
$dbname = "stats";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "welcome";
$list = array ('date', 'success', 'failure','count');
$sql = "SELECT UNIX_TIMESTAMP('date')from h_statistics;";
$users_profile_user_id = mysqli_query($conn, $sql);
$fp = fopen("user_profile19.csv", "w");
fputcsv($fp, $list);
while($row = mysqli_fetch_array($users_profile_user_id, MYSQLI_ASSOC)){
fputcsv($fp, $row);
}
fclose($fp);
?>
@Abhik先生謝謝你的重要信息。 – Saty