TImestamp with milliseconds or ten thousandths of a second

TImestamp with milliseconds or ten thousandths of a second

Postby JORGEMAL » Thu 01 Sep 2016 23:21

I am using PostgreSQL and dotConnect for PostgreSQL to develop an application in .NET where I use a timestamp field. Actually, I am inserting records with the format ToString("yyyy/MM/dd HH:mm:ss"). Is it possible to specify milliseconds or ten thousandths of a second?

According to Microsoft documentation (https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx) I am trying ToString("yyyy/MM/dd HH:mm:ss.fff") for milliseconds and ToString("yyyy/MM/dd HH:mm:ss.ffff") for ten thousandths of a second but I get an error saying that syntax is not valid. However, the format ToString("yyyy/MM/dd HH:mm:ss") works pefectly well.

Regards.
JORGEMAL
 
Posts: 165
Joined: Thu 03 Jul 2008 23:55

Re: TImestamp with milliseconds or ten thousandths of a second

Postby Pinturiccio » Mon 05 Sep 2016 15:58

Please provide a snippet of code where you create a command with the command text, parameter value, and ToString("yyyy/MM/dd HH:mm:ss") code.

You can use a DateTime or PgSqlTimestamp value for the parameter instead of a string. For more information, please refer to https://www.devart.com/dotconnect/postgresql/docs/?Devart.Data.PostgreSql~Devart.Data.PostgreSql.PgSqlTimeStamp.html
Pinturiccio
Devart Team
 
Posts: 2020
Joined: Wed 02 Nov 2011 09:44


Return to dotConnect for PostgreSQL