nem.ec

Programming Information Security Recipes Personal Code Snippets

Convert Unix time to datetime

# https://stackoverflow.com/a/59758661/564755
import datetime

timestamp = 1579117901
value = datetime.datetime.fromtimestamp(timestamp)
print(f"{value:%Y-%m-%d %H:%M:%S}")

via https://superuser.com/a/1041818/91462

Copied!

Use your own input

If you have values you'd like to use instead of the provided variables, type or paste your data into the variable inputs below. If Javascript is enabled, your text will automatically be added to the command and you can click to copy.