0

I am currently inserting current timestamp in my postgresdb. As shown below, the date 19th feb got inserted.

enter image description here

but when I got to Django shell and printed all the dates, its printing 18th feb. How can i solve this confusion.

In my settings.py, current timezone is set to UTC and I cannot change that. Please suggest

Mahesh
  • 1,117
  • 2
  • 23
  • 42

1 Answers1

2

The dates are actually never saved with timezone in the DB. PgAdmin just renders the data based on your local timezone. In order to set it to UTC, open a new Query Tool in PgAdmin and do:

SET TIMEZONE='UTC';

select * from your_table
Horatiu Jeflea
  • 7,256
  • 6
  • 38
  • 67