0

I wrote this code in Python:

import datetime
print(datetime.datetime.fromtimestamp(0).strftime('%Y-%m-%d %H:%M:%S'))

It gave me: 1970-01-01 05:30:00

What is so special about this date and time in programming, especially to Python?

Coder Alpha
  • 157
  • 1
  • 10
  • 2
    See the [docs](https://docs.python.org/3/library/time.html). "The epoch is the point where the time starts, and is platform dependent. For Unix, the epoch is January 1, 1970, 00:00:00 (UTC)." – not_speshal Oct 04 '21 at 12:58
  • Yes, i guess.... – Coder Alpha Oct 04 '21 at 13:01
  • You can add a parameter `tz` to .fromtimestamp - set it to `tz=datetime.timezone.utc` and you'll get 1970-01-01 UTC. The 5:30 h is your local time UTC offset. – FObersteiner Oct 04 '21 at 13:19

0 Answers0