I'm using PHP to insert a query into a database.
I am using
Try the code below:
(I have written the code in PDO as you did not specify which extension you were using.)
<?php date_default_timezone_set('Europe/London'); $time_stamp = date('Y-m-d H:i:s'); $stmt = $con->prepare("INSERT INTO tablename (datetime) VALUES ('".$time_stamp."')"); $stmt->execute(); ?>