Questions tagged [python-dateutil]

The dateutil module provides powerful extensions to the standard datetime module, available as an extension module which is compatible with Python 2.3+.

The dateutil module provides powerful extensions to the standard datetime module, available as a Python extension module which works with Python 2.3+.

432 questions
77
votes
4 answers

Matplotlib issue on OS X ("ImportError: cannot import name _thread")

At some point in the last few days, Matplotlib stopped working for me on OS X. Here's the error I get when trying to import matplotlib: Traceback (most recent call last): File "/my/path/to/script/my_script.py", line 15, in import…
Dolan Antenucci
  • 15,432
  • 17
  • 74
  • 100
56
votes
2 answers

ImportError: matplotlib requires dateutil

I have successfully installed matplotlib with python 2.6 on x64 Windows7. When I try to import matplotlib, it shows the following error. I have also installed numpy following this link: Installing Numpy on 64bit Windows 7 with Python 2.7.3 import…
user2690469
  • 581
  • 1
  • 4
  • 5
54
votes
4 answers

What is the replacement for dateutil.parser in python3?

Python 2.x has a great function called dateutil.parser which turns an ISO8601 formatted date into a python datetime value. It's not present in Python 3. What is the replacement?
vy32
  • 28,461
  • 37
  • 122
  • 246
51
votes
11 answers

How to install python-dateutil on Windows?

I'm trying to convert some date/times to UTC, which I thought would be dead simple in Python - batteries included, right? Well, it would be simple except that Python (2.6) doesn't include any tzinfo classes. No problem, a quick search turns up…
Mark Ransom
  • 299,747
  • 42
  • 398
  • 622
51
votes
4 answers

Python datetime strptime() and strftime(): how to preserve the timezone information

See the following code: import datetime import pytz fmt = '%Y-%m-%d %H:%M:%S %Z' d = datetime.datetime.now(pytz.timezone("America/New_York")) d_string = d.strftime(fmt) d2 = datetime.datetime.strptime(d_string, fmt) print d_string print…
CuriousMind
  • 15,168
  • 20
  • 82
  • 120
51
votes
3 answers

Installing python dateutil

I tried to install python dateutil for my django tastypie but unsuccessful, http://labix.org/python-dateutil#head-2f49784d6b27bae60cde1cff6a535663cf87497b I downloaded the tar file in c:/python27 and unzipped it, I get the following error…
user1050619
  • 19,822
  • 85
  • 237
  • 413
49
votes
2 answers

Python dateutil.parser.parse parses month first, not day

I'm using dateutil.parser.parse to format a date from a string. But now it mixes up the month and the day. I have a string that contains 05.01.2015. After dateutil.parser.parse("05.01.2015") it returns: datetime.datetime(2015, 5, 1, 0, 0) I hoped…
Timo002
  • 3,138
  • 4
  • 40
  • 65
47
votes
1 answer

Upgrade the Python package dateutil: Could not find a version

I tried to upgrade dateutil from 2.5.3 to the newest version 2.6.0 with pip install dateutil --upgrade, but got the issue Could not find a version. $ pip install dateutil --upgrade Collecting dateutil Could not find a version that satisfies the…
SparkAndShine
  • 17,001
  • 22
  • 90
  • 134
44
votes
8 answers

python 2.7: cannot pip on windows "bash: pip: command not found"

I am trying to install the SciPy stack located at https://scipy.org/stackspec.html [I am only allowed 2 links; trying to use them wisely]. I realize that there are much easier ways to do this, but I think there is a lot to be learned by doing it…
Saladsamurai
  • 587
  • 2
  • 5
  • 11
43
votes
1 answer

AttributeError when using "import dateutil" and "dateutil.parser.parse()" but no problems when using "from dateutil import parser"

I was playing with the dateutil module in Python 2.7.3. I simply wanted to use: import dateutil dateutil.parser.parse("01-02-2013") But I got an error: AttributeError: 'module' object has no attribute 'parser' I checked what attributes dateutil…
Stefan van den Akker
  • 6,661
  • 7
  • 48
  • 63
38
votes
4 answers

Python cannot find dateutil.relativedelta

I am trying to run a program using paster serve, but I keep getting the error: ImportError: No module named dateutil.relativedelta I am running Python version 2.6.7 and dateutil version 1.5, so it should be installed. Has anyone got any ideas as…
RonnyKnoxville
  • 6,166
  • 10
  • 46
  • 75
29
votes
6 answers

Get the format in dateutil.parse

Is there a way to get the "format" after parsing a date in dateutil. For example something like: >>> x = parse("2014-01-01 00:12:12") datetime.datetime(2014, 1, 1, 0, 12, 12) x.get_original_string_format() YYYY-MM-DD HH:MM:SS # %Y-%m-%d %H:%M:%S #…
David542
  • 104,438
  • 178
  • 489
  • 842
26
votes
4 answers

Using datetime.timedelta to add years

I am doing some time calculations in Python. Goal: Part of this is trying to : Given a date, add time interval (X years, X months, X weeks), return date ie input args: input_time (datetime.date), interval (datetime.timedelta) return:…
patrick
  • 4,455
  • 6
  • 44
  • 61
22
votes
5 answers

What's the difference between pytz and dateutil?

I'm trying to implement timezone awareness in my Python application, and I have come across two different Python modules that implement this feature: pytz and python-dateutil. What is the difference between these two modules? (pytz)…
fangsterr
  • 3,670
  • 4
  • 37
  • 54
19
votes
5 answers

How to parse multiple dates from a block of text in Python (or another language)

I have a string that has several date values in it, and I want to parse them all out. The string is natural language, so the best thing I've found so far is dateutil. Unfortunately, if a string has multiple date values in it, dateutil throws an…
mlissner
  • 17,359
  • 18
  • 106
  • 169
1
2 3
28 29