Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#20602 closed Uncategorized (worksforme)

Won't recognize daylight saving time

Reported by: thenajnth@… Owned by: nobody
Component: Internationalization Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When a date is stored in database as 2013-06-12 17:30:00+00:00. It shows up as 19:30 when using:

TIME_ZONE = 'Europe/Stockholm'

In summertime, as it is now, Stockholm is +1 so I was expecting it showed up as 18:30.

I hope I don't have misunderstand how timezones work. But I have put up a question on StackOverflow without receiving any answers. I came to the conclusion that this might be a problem with the Django.

Change History (2)

comment:1 by Aymeric Augustin, 11 years ago

Resolution: worksforme
Status: newclosed

Stockholm is in CEST, which means UTC+2 in summertime.

>>> import datetime
>>> import pytz
>>> dt = datetime.datetime(2013, 6, 12, 17, 30, 0, 0, pytz.utc)
>>> stockholm = pytz.timezone('Europe/Stockholm')
>>> stockholm.normalize(dt.astimezone(stockholm))
datetime.datetime(2013, 6, 12, 19, 30, tzinfo=<DstTzInfo 'Europe/Stockholm' CEST+2:00:00 DST>)

comment:2 by anonymous, 11 years ago

I feel really stupid for not catching that. Sorry to disturb with a Bug report. Really grateful for the help!

Note: See TracTickets for help on using tickets.
Back to Top