It seems that:
time.strftime("%Y-%m-%d %H:%M:%S")
#2017-01-12 10:46:57
datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S")
#2017-01-12 10:46:57
are equivalent. When I read many questions/answers here, or tutorials or documentation, some of them use the former, some the latter.
Are they 100% equivalent? When to prefer the one or the other?
PS: the latter seems to be equivalent to datetime.date.fromtimestamp(time.time())
, but is this equivalent to time.strftime(...)
?
No comments:
Post a Comment