This can be done with the time and datetime modules. Use time.strptime to create struct_time objects. Example:
- timeObj = time.strptime(data, "%d.%m.%Y %H:%M:%S")
To determine the difference between timeObj and a struct_time object you can create for the epoch, create a datetime.datetime object. Example:
- dt1 = datetime.datetime(*timeObj[:6])
The difference is:
The seconds to the epoch is then:
To adjust for local time:
- td1.total_seconds()+time.timezone
To convert back to a string representation:
- time.strftime("%d.%m.%Y %H:%M:%S", timeObj)