I create object:
{
id = 123,
dateTimeOffset = DateTime.UtcNow // 2024-02-27 21:42:43.7125911 +0h
}
and save it to postgres db with dapper. Then I read that object from db with dapper and get
2024-02-27 21:42:43.712591 +0h
As you could see, value from db is 1 digit shorter than original value.
Why does it happen? And how to fix it. Thank you.
The resolution of PostgreSQL's
timestampandtimetypes is 1 microsecond, as written here in the documentation: https://www.postgresql.org/docs/current/datatype-datetime.htmlYour last digit corresponds to a tenth of a microsecond and therefore gets truncated.