- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Why do I get different timestamps in python on different machines?
An timestamp is an offset value between a point in time line and the epoch, it's nothing to do with timezone. When it's converted to a human readable string like '%Y-%m-%d %H:%M:%S' that doesn't include any timezone information, python assumes that you want to use local timezone setting.
datetime.timestamp() on a naive datetime object calls mktime() internally i.e., the input is interpreted as the local time. Local time definitions may differ between systems.
C mktime() may return a wrong result if the local timezone had different utc offset in the past and a historical timezone database is not used.
On Unix, when we call timestamp(), the interpreter uses the tz database available on UNIX systems to get the timezone information. While it doesn't have it on windows.
- Related Articles
- Why do different substances catch fire at different temperatures?
- Why do Passports have different colours ?
- Why do some leaves are different in colour?
- Why do identical twins have different fingerprints?
- Why is the weight of the same object different on different planets?
- Why do humans have different types of teeth?
- Why different flowers bear different colors?
- Why different animals live in a different environment?
- Why do metals have different melting and boiling points?
- Why do we need to wear different types of clothes?
- Why do plants and animals possess different types of tissues?
- Why do Python lambdas defined in a loop with different values all return the same result?
- Python - Drawing different shapes on PyGame window
- Why do plants are differentiated into different parts of the plants?
- Why are buttons on men’s and women’s clothes placed on different sides?
