I need to update the date in the field date, of type datetime, in a table, taking the date of today, for example. I'm trying to do this:
$dataHoje = new DateTime();
$sql = "UPDATE [RDO].[dbo].[ANALISE_CRITICA] SET
TXTOBS='$objetoExtra',
VLRECEITACONT='$receitaContrato', VLRECEITABRUTA='$receitaBrutaMarco',
VLISSQN='$percentualIssqn',
VLBASE='$baseCalculoIssqn',
VLIMPOSTTOTAL='$valorTotalImpostos',
VLCOMISSAO='$comissionamento',
VLCUSTO='$custoDireto',
VLADMLOCAL='$admLocal',
VLRISCO='$risco',
VLCUSTOFIN='$custoFinanceiro',
VLADMCENTRAL='$admCentral',
VLRESULTFIN='$resultadoFinanceiro',
VLCORRETAGENS='$corretagem',
dataAlteracao = $dataHoje
WHERE ID=$id";
$stmt = @sqlsrv_query( $conn, $sql);
However, when trying to update the system I get the following warning: "Catchable fatal error: Object of class DateTime could not be converted to string" What problem is this?