2

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.

zero

What am I doing wrong?

4

1 に答える 1

2

datetime オブジェクトをパラメーター int 彼の方法として直接渡すことができるはずです。

 MyStoredProc.ParamByName('date').Value := Now;

また :

 MyStoredProc.ParamByName('date').AsDateTime := Now;

もちろん、PostgreSQL 関数のパラメータはタイムゾーン タイプである必要があります。

于 2015-10-06T09:34:00.117 に答える