The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT) .
Literally speaking the epoch is Unix time 0 (midnight 1/1/1970), but 'epoch' is often used as a synonym for Unix time.
In python, the time.mktime() method converts a timestamp struct into seconds since the epoch. The time.localtime() converts seconds back to the local time.
import time
#get current location time
#this returns a time tuple :
# time.struct_time(tm_year=2022, tm_mon=3, tm_mday=23, tm_hour=15, tm_min=7, tm_sec=26, tm_wday=2, tm_yday=82, tm_isdst=0)
t = time.localtime()
#get time string 2022-03-23 15:07:26
t_str = time.strftime('%Y-%m-%d %H:%M:%S', t)
#get the seconds from 1970
#1648012046.0
t_seconds = time.mktime(t)
#convert the seconds back to local time
# time.struct_time(tm_year=2022, tm_mon=3, tm_mday=23, tm_hour=15, tm_min=7, tm_sec=26, tm_wday=2, tm_yday=82, tm_isdst=0)
t_back = time.localtime(t_seconds)
#get the epoch start time
#time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=10, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)
#the local time takes time zone, +10 here, into account
t_start = time.localtime(0)