This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: datetime.weekday() off by one if handling a date from utcfromtimestamp()
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.4, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: odianus
Priority: normal Keywords:

Created on 2015-09-17 12:16 by odianus, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg250881 - (view) Author: AndreC (odianus) Date: 2015-09-17 12:16
I've stumbled over an odd datetime.weekday() behaviour in Python 2.7.8 (default, Jun 18 2015, 18:54:19)  [GCC 4.9.1] on linux2) under Ubuntu. weekday() is off by 1.

Code to reproduce:

from datetime import datetime
date = datetime.utcfromtimestamp(int('1410446564'))  # datetime.datetime(2014, 9, 11, 14, 42, 44)
date.weekday()  # should be 4, not 3

I can reproduce this behaviour on our dev and production systems, and just tested it locally with python 3.4.3.

Since I'm not a smart man, I might overlook something silly...
msg250885 - (view) Author: AndreC (odianus) Date: 2015-09-17 13:10
as I said, I'm not a smart man, the sort order was wrong and the year was simply wrong... sorry :-/
History
Date User Action Args
2022-04-11 14:58:21adminsetgithub: 69336
2015-09-17 13:10:31odianussetstatus: open -> closed
resolution: not a bug
messages: + msg250885
2015-09-17 12:16:58odianuscreate