Page 1 of 1

PgSqlTimeStamp <-> DateTimeOffset conversion

Posted: Thu 22 Oct 2009 11:36
by acerbitdrain
What is your recommended practice for converting PgSqlTimeStamp to DateTimeOffset and vice versa?

Thank you.

Posted: Fri 23 Oct 2009 11:37
by Shalex
Please make conversion in the following way:

Code: Select all

      PgSqlTimeStamp time = new PgSqlTimeStamp(2009,10,22);
      //checking if PgSqlTimeStamp in the range of DateTime
      if ((time.CompareTo(new PgSqlTimeStamp(1, 1, 1, 0, 0, 0)) >= 0) && (time.CompareTo(new PgSqlTimeStamp(9999, 12, 31, 23, 59, 59))  PgSqlTimeStamp
        time = dt.DateTime;
      }