我有這樣的語句來保存在MySQL的日期,但我會把它保存爲一個例子:格式日期在MySQL
September 24, 2011, 6:39 am
。
或者我應該擁有它並且當我檢索它時,我會如此迴應它嗎?
try {
$date = date('Y-m-d H:i:s');
//insert into database with a prepared statement
$stmt = $db->prepare('INSERT INTO admin (username, password, email, register_date, active) VALUES (:username, :password, :email, :register_date, :active)');
$stmt->execute(array(
':username' => $_POST['username'],
':password' => $hashedpassword,
':email' => $_POST['email'],
':register_date' => $date,
':active' => $activasion
));
//else catch the exception and show the error.
} catch(PDOException $e) {
$error[] = $e->getMessage();
}
備註:請不要使用'>'字符作爲個人格式設置;他們是爲了一個特殊的目的。我[編輯](https://stackoverflow.com/revisions/45334837/2)那些了。 –
這是我如何從表 $ nestedData [] = $ row [「register_date」]; –