mySpindel/flatten/unixtimes.py

28 lines
442 B
Python
Raw Normal View History

2022-05-06 17:33:17 +02:00
#!/usr/bin/python3
import datetime
""""""
TIMESTAMPS = (
161252911000,
162352411900,
1646927061000,
166691206100000,
)
def from_stamp(i: int) -> str:
dt = str(i)
if len(dt)>10:
dt = dt[:10]
sdt = str(datetime.datetime.fromtimestamp(int(dt)))
print(f" {dt} : {sdt}")
return sdt
if __name__ == "__main__":
print("formatted UNIX dates")
for i in TIMESTAMPS:
from_stamp(i)