from datetime import datetime
import pytz
tz = pytz.timezone("Asia/Singapore")
date_1 = datetime.now(tz=pytz.utc)
print(date_1.replace(tzinfo=tz).replace(tzinfo=pytz.utc).timestamp())
print(date_1.timestamp())
date_2 = datetime.now(tz=tz)
print(date_2.replace(tzinfo=pytz.utc).replace(tzinfo=tz).timestamp())
print(date_2.timestamp())
1483599557.338336
1483599557.338336
1483603457.33842
1483599557.33842
pourquoi les horodateurs de la variable Date_2 sont différents après tzinfo remplacé deux fois?
puisque la variable date_1 est la même.
Il y a une petite période de temps qui passe entre vos impressions. Essayez d'assigner à date_1 et date_2 avant d'imprimer les deux. – rocksteady
http://stackoverflow.com/questions/11473721/weird-timezone-issue-with-pytz – hoozecn