Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14126

Datetime from year and week number

$
0
0

I have a year and a week number which I want to convert into a datetime.datetiem object. My (naive?) reading of the documentation hinted that strptime('2016 00', '%Y %W') should do just that. However:

In [2]: from datetime import datetimeIn [3]: datetime.strptime('2016 00', '%Y %W')Out[3]: datetime(2016, 1, 1, 0, 0)In [4]: datetime.strptime('2016 52', '%Y %W')Out[4]: datetime(2016, 1, 1, 0, 0)

What am I doing wrong?


Viewing all articles
Browse latest Browse all 14126

Trending Articles