Good, I have some records in my BD Posgre, and when I bring it, it appears 5 hours in advance.
In my BD it comes out 2020-01-14 18:37:50-05
and when I bring it up it appears 14/01/2020 23:37:50
I don't understand why this happens
while (reader.Read())
{
Dates _date = new Dates();
_date.Fecha_I = DateTime.Parse(reader[2].ToString());
}
I have tried the following without any success and it also throws the exceptionString '14/01/2020 23:37:50' was not recognized as a valid DateTime.
_date.Fecha_I = DateTime.ParseExact(reader[2].ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
_date.Fecha_I = DateTime.ParseExact(reader[2].ToString(), "d/M/yyyy hh:mm:ss tt", CultureInfo.InvariantCulture);
If you pay attention, the time is 5 hours ahead and it is no coincidence.
Apparently the time is being read in UTC. You just have to convert to your time zone.
An example with a zone with a time zone similar to yours: