[{"user_id": 8558, "stars": [], "topic_id": 17859, "date_created": 1302194127.875623, "message": "Oh, this is python 2.6.6 and python 2.7.1 on Linux with pytz version 2011e.", "group_id": 292, "id": 577108}, {"user_id": 8558, "stars": [], "topic_id": 17859, "date_created": 1302193993.7555981, "message": "#!/usr/bin/env python\n# -*- mode: python; coding: utf-8 -*-\n\nfrom datetime import datetime\nfrom pytz import timezone, __version__\n\nUTC = timezone('UTC')\nCPH = timezone('Europe/Copenhagen')\n\nFMT = '%F %T %Z (UTC%z)'\n\nnowUTC = datetime(*datetime.utcnow().timetuple()[:7], tzinfo=UTC)\nnowCPH = datetime(*datetime.now().timetuple()[:7], tzinfo=CPH)\n\nprint nowUTC.strftime(FMT)\nprint nowCPH.strftime(FMT)\nprint nowUTC.astimezone(CPH).strftime(FMT)\n\n# eof\n", "group_id": 292, "id": 577080}, {"user_id": 8558, "stars": [], "topic_id": 17859, "date_created": 1302193983.288722, "message": "I have the following script:", "group_id": 292, "id": 577079}, {"user_id": 8558, "stars": [], "topic_id": 17859, "date_created": 1302194003.249563, "message": "That gives the following output:", "group_id": 292, "id": 577081}, {"user_id": 8558, "stars": [], "topic_id": 17859, "date_created": 1302194017.186986, "message": "2011-04-07 16:31:41 UTC (UTC+0000)\n2011-04-07 18:31:41 CET (UTC+0100)\n2011-04-07 18:31:41 CEST (UTC+0200)\n", "group_id": 292, "id": 577085}, {"user_id": 8558, "stars": [{"date_created": 1302210049.5480659, "user_id": 141}], "topic_id": 17859, "date_created": 1302194083.3843391, "message": "The two last lines show the correct local time for Copenhagen, but the timezone \u201cCET (UTC+0100)\u201d is wrong.\nWhat gives?", "group_id": 292, "id": 577102}, {"user_id": 18417, "stars": [], "topic_id": 17859, "date_created": 1302240491.019973, "message": "I knew I'd run into this before but couldn't remember the solution. A bit of googling yielded http://stackoverflow.com/questions/1357711/pytz-utc-conversion. The solution seems to be in the normalize function.", "group_id": 292, "id": 586906}, {"user_id": 8558, "stars": [], "topic_id": 17859, "date_created": 1302253913.6125331, "message": "@dryan Thanks a lot, the .normalize() method \u2014 however counter-intuitive I find it \u2014 soves the problem.", "group_id": 292, "id": 588052}, {"user_id": 8558, "stars": [], "topic_id": 17859, "date_created": 1302257028.5502019, "message": "Oh no, .normalize() doesn't solve the problem. I thought it did because the timezones were correct and I didn't notice the time itself was 1 hour ahead. I should use the .localize() method instead (in the original example that would be: nowCPH = CPH.localise(datetime.now()), which is what I expected datetime(\u2026, tzinfo=CPH) to accomplish). But thanks again, the problem is solved.", "group_id": 292, "id": 588245}, {"user_id": 8558, "stars": [], "topic_id": 17859, "date_created": 1302257050.907999, "message": "| s/localise/localize/", "group_id": 292, "id": 588246}, {"user_id": 18417, "stars": [], "topic_id": 17859, "date_created": 1302383023.8736961, "message": "funny enough I just ran into this today again. thanks for pointing out the full fix.", "group_id": 292, "id": 605499}]