Thread: TImestamp with milliseconds or ten thousandths of a second
Hi,
I am using PostgreSQL to develop an application in .NET where I use a timestamp field. Actually, I am inserting records with the format "yyyy/MM/dd HH:mm:ss". Is it possible to specify milliseconds or ten thounsandths of a second? Is this a PostgreSQL issue or a .NET issue? I guess it is a PostgreSQL issue because the error is generated by the PostgreSQL data provider.
I am trying "yyyy/MM/dd HH:mm:ss.fff" for milliseconds and "yyyy/MM/dd HH:mm:ss.ffff" for ten thousandths of a second but I get an error saying that syntax is not valid.
Respectfully,
Jorge Maldonado
Hi Jorge,
ffff is probably a .Net specifier. What API are you using to connect to PostgreSQL? NGPSQL?
PostgreSQL should store timestamps down to the microsecond.
Formatting should be:
MI | minute (00-59) |
SS | second (00-59) |
MS | millisecond (000-999) |
US | microsecond (000000-999999) |
Can find details in the documentation here:
Cheers
Gary
On Fri, Sep 2, 2016 at 8:36 AM, JORGE MALDONADO <jorgemal1960@gmail.com> wrote:
Hi,I am using PostgreSQL to develop an application in .NET where I use a timestamp field. Actually, I am inserting records with the format "yyyy/MM/dd HH:mm:ss". Is it possible to specify milliseconds or ten thounsandths of a second? Is this a PostgreSQL issue or a .NET issue? I guess it is a PostgreSQL issue because the error is generated by the PostgreSQL data provider.I am trying "yyyy/MM/dd HH:mm:ss.fff" for milliseconds and "yyyy/MM/dd HH:mm:ss.ffff" for ten thousandths of a second but I get an error saying that syntax is not valid.Respectfully,Jorge Maldonado