Ich versuche, X Monat zum aktuellen Datetime hinzuzufügen:PostgreSQL hinzufügen X Monate zu einem Datum
UPDATE mytable SET thedate=NOW() + INTERVAL '12 month' WHERE id=1
Aber ich habe:
SQLSTATE[22007]: Invalid datetime format: 7 ERROR: invalid input syntax for timestamp: « NOW() + INTERVAL '12 month' »
Was sollte die richtige syntaxe sein?
Edit: scheint es von meinem PHP kommt Prepare/execute-Syntax
$t = $connect->prepare('UPDATE mytable
SET thedate=:duree
WHERE id=:id');
$ok = $t->execute([
':duree' => "NOW() + INTERVAL '$duree month'",
':id' => $user,
]);
Können Sie eine englische Fehlermeldung bitte teilen? – Mureinik
Ja sorry, es ist update – Macbernie
Auch - welche Postgres Version verwendest du? – Mureinik