ich hab ein Problem mit dem Umwandeln der Zeit von CET nach der lokalen Zeit. Was ich letzlich benötige ist ein Timestamp der aktuellen lokalen Zeit (MESZ). Hier der Code, den ich schonmal habe:
Code: Alles auswählen
import sys, os, stat, datetime, time, pytz
from datetime import datetime, timedelta
from pytz import timezone
strptime = time.strptime("13 Nov 04 12 25 12", "%d %b %y %H %M %S")
utc = pytz.utc
print strptime
atime= time.mktime(strptime)
print atime
utc_dt = utc.localize(datetime.utcfromtimestamp(atime))
print utc_dt
fmt = "%d %b %y %H %M %S"
utc_dt.strftime(fmt)
de_tz = timezone('Europe/Berlin')
de_dt = au_tz.normalize(utc_dt.astimezone(de_tz))
print de_dt
loc_dt = time.strptime("de_dt", "%d %b %y %H %M %S")
loc_atime= time.mktime(strptime)
exceptions.ValueError: time data 'de_dt' does not match format '%d %b %y %H %M %S'
Kann mir da bitte jemand einen Tip geben