split = datetime.split("T")
date = split[0]
time = split[1]
if len(split) == 2:
time_zone = datetime.split("T")[2]
if isinstance(dt, datetime.datetime):
date = dt.date().isoformat()
time = dt.time().isoformat()
if dt.tzname() is not None:
After Change
if "+" in sp[1]:
time = "%s" % sp[1].split("+")[0]
time_zone = "+%s" % sp[1].split("+")[1]
elif "-" in sp[1]:
time = "%s" % sp[1].split("-")[0]
time_zone = "-%s" % sp[1].split("-")[1]
if isinstance(dt, datetime.datetime):
date = dt.date().isoformat()
time = dt.time().isoformat()
if dt.tzname():
time_zone = dt.tzname()
metadata.set_item("General.date", date)
metadata.set_item("General.time", time)
if time_zone:
metadata.set_item("General.time_zone", time_zone)
if metadata.has_item("General.time_zone") and not time_zone:
del metadata.General.time_zone
return metadata