I have a column in my PostgreSQL database, which is in timestamp without time zone
format. I would like to save the current date there using the following code:
MyStoredProc.ParamByName('date').Value := FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', Now);
The date
value in my stored procedure is declared as DateTime
, but setting it to PgTimeStamp
does not help either. The first column is created in PostgreSQL, timestamps working correctly, but the second one, where I´m trying to save data from my code, is always showing zeros.
What am I doing wrong?
You should be able to pass directly the datetime object as parameter int his way :
MyStoredProc.ParamByName('date').Value := Now;
or :
MyStoredProc.ParamByName('date').AsDateTime := Now;
Of course the parameter of the PostgreSQL function must be timezone type.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.