ASD ASD - 6 months ago 42
MySQL Question

Inserting DATE TIMESTAMP Value to MySQL Using PHP

Using php I am inserting or updating the mysql database with create date or modified date using the variables

$datestring = "%Y:%m:%d %h:%i:%s";
$time = time();
$createdate= mdate($datestring, $time);

In this
will be the variable I use to insert or update the table. But it's updating the wrong value. It's not the server time or localtime. Mostly it's 30 mins delay with the server's time.


Use date() function of PHP

$createdate= date('Y-m-d H:i:s');