tags:

views:

22

answers:

2

i want to insert server time to table.i will use mysql.

+1  A: 

Use NOW(). It's a MySQL function.

This assumes your database is on the same server as your main server.

Kerry
A: 

Use NOW() as Kerry says. If you're using PHP and don't want the MySQL server time but the PHP time, use this:

$time = date('Y-m-d H:i:s');
$query = "INSERT INTO example(timefield) VALUES('$time');";
Emil Vikström