28 lines
442 B
Python
28 lines
442 B
Python
|
#!/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)
|
||
|
|
||
|
|