ASD ASD - 1 year ago 93
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.

Answer Source

Use date() function of PHP

$createdate= date('Y-m-d H:i:s');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download