如何在postgresql中插入日期?当我错了吗?
public function insert( $name, $author ) {
$this->query = "INSERT INTO people ( name, author, date )
VALUES ( '$name', '$author', to_timestamp('2/3/2016 12:05')";
return $result = pg_query( $this->connection, $this->query );
}
$database->insert( 'someName', 'SomeAuthor' );
答案 0 :(得分:0)
'2016-03-02 12:05:00'是一种方式......
$this->query = "INSERT INTO people ( name, author, date )
VALUES ( '$name', '$author', '2016-03-02 12:05:00')";