下面的代码将MySQL存储的日期转换为英国夏令时。我试图得到MySQLi等价物?
date_default_timezone_set('Europe/London');
mysql_query("SET time_zone = '".date('P')."';");
下面是一个关于W3C的简单示例
<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Perform queries
mysqli_query($con,"SELECT * FROM Persons");
mysqli_query($con,"INSERT INTO Persons (FirstName,LastName,Age)
VALUES ('Glenn','Quagmire',33)");
mysqli_close($con);
?>
谷歌是你的朋友。,)
日期格式仍然是PHP和MySQL,不用担心mysqli
希望能有所帮助。