Skip to content

Timestampt before Christ #872

Closed
Closed

Description

@KondratenkoAndrey

Hi!

I have a postgresql database with a 'timestampz' field.
This field has dates before Christ (not infinite), like 0001-12-31 09:00:00+00 BC, but the CLR type DateTime does not support dates before Christ.
Therefore, I get an exception
"System.InvalidCastException: "Out of the range of DateTime (year must be between 1 and 9999)"

Maybe need to add a cast to DateTime.MinValue and DateTime.MaxValue if date is out of range?

Activity

  1. austindrenski commented on Jul 16, 2019

    @austindrenski
    Contributor

    @KondratenkoAndrey Take a look at Npgsql's NodaTime plugin which maps NodaTime CLR types to PostgreSQL types, allowing you to represent for the full range of PostgreSQL date and time values.

    I'm going to close this issue for now, but please feel free to post back if you have further questions about date/time support in Npgsql.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions