Thread: TImestamp with milliseconds or ten thousandths of a second

TImestamp with milliseconds or ten thousandths of a second

From
JORGE MALDONADO
Date:
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

Re: TImestamp with milliseconds or ten thousandths of a second

From
Gary Evans
Date:
Hi Jorge,

PostgreSQL should store timestamps down to the microsecond.

Formatting should be:
MIminute (00-59)
SSsecond (00-59)
MSmillisecond (000-999)
USmicrosecond (000000-999999)
ffff is probably a .Net specifier.  What API are you using to connect to PostgreSQL? NGPSQL?

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