Izak
Izak

Reputation: 23

Issue with dates when displaying on Page

This is what shows up on the Page. Note the Birth Date on the left side of the page Please note the birth_date value from the database.

The issue I have is the following: When I display dates on the page, they show up 1 day less than what is stored on the database. How do I fix this issue?

Upvotes: 0

Views: 23

Answers (1)

Izak
Izak

Reputation: 23

I noticed how the dates in the database are 1984-12-30 00:00:00 meaning its at the start of the 30th of December but for the Timezone that's +2. In the settings.py for my project I noticed the TimeZone is UTC (which is +0), meaning that that DateTime at UTC was actually 1984-12-30 22:00:00 (2 hours behind).

I fixed this issue by changing the TimeZone for my Django server to a +2 Timezone, so the dates are represented properly.

The fix I made in settings.py

EDIT: typos

Upvotes: 1

Related Questions