# PostGreSQL .NET DateTime Usage

.NET EF Core 6 made a breaking change to how DateTime is stored in PostGreSQL.

This article explains some of it and the workaround: [https://github.com/npgsql/efcore.pg/issues/2000](https://github.com/npgsql/efcore.pg/issues/2000 "https://github.com/npgsql/efcore.pg/issues/2000")

To enable the workaround, add this to the Configure method of your Startup.cs:

`AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);`

See this page for what datatypes should be used: [https://www.npgsql.org/doc/types/datetime.html](https://www.npgsql.org/doc/types/datetime.html "https://www.npgsql.org/doc/types/datetime.html")