Code

Opened 10 months ago

Closed 10 months ago

Last modified 10 months 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.

Attachments (0)

Change History (2)

comment:1 Changed 10 months ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

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 Changed 10 months ago by anonymous

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.