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
11
votes
0 answers

Exclude calendar holidays from rrule before processing

I am using the rrule method from python-dateutil package. I would like to create a rule that can ignore dates that are within a holiday calendar. I know about the exdate() method but this seems to filter the date from the output list only it has…
Blair Azzopardi
  • 502
  • 8
  • 17
10
votes
2 answers

Python dateutil.parser throws "ValueError: day is out of range for month"

I have a the following code that runs fine with input format like {Year}/{Month} except when it comes to 1994/02 Here is the sample code >>> import dateutil.parser as dtp >>> dtp.parse('1994/01') datetime.datetime(1994, 1, 29, 0, 0) >>>…
Antony
  • 5,414
  • 7
  • 27
  • 32
9
votes
2 answers

Conda says conflict over installing dateutil in Python 3.5.1

I have a Python 3.5.1 environment managed by conda. I'm trying to create a new Python 3.5.1 environment with conda create and listing several of the modules I want in the new environment. One such module is dateutil (not python-dateutil), which is…
ely
  • 74,674
  • 34
  • 147
  • 228
9
votes
2 answers

Timezone offset sign reversed by dateutil?

Does anyone know why python's dateutil reverses the sign of the GMT offset when it parses the datetime field? Apparently this feature is a known outcome of not only dateutil but also other parsing functions. But this results in an incorrect datetime…
R J
  • 4,473
  • 2
  • 22
  • 29
9
votes
3 answers

Python dateutils print recurrence rule according to iCalendar format (see RFC 5545)

I am trying to print a recurrence rule as a string specified by iCalendar format (see RFC 5545). Im using python dateutils, in particular dateutil.rrule to create the recurrence rule and I want to print this as a string like: …
8
votes
5 answers

Converting DDMMYYYY with dateutil.parser

I have the following string input : 24052017. When I try to do: >>>dateutil.parser.parse("24052017") It tells me that month must be in 1..12. I have even tried doing: >>>dateutil.parser.parse("24052017", firstday=True) It gives me exactly th same…
Renier
  • 1,523
  • 4
  • 32
  • 60
7
votes
2 answers

Mypy can't find python-dateutil even after importing types-python-dateutil

I am running Mypy v0.910 with pre-commit. It complains that python-dateutil does not have type stubs. However, even after installing the stubs, I get the same error. My pre-commit config is default_language_version: python: python3 repos: …
Troy Daniels
  • 3,270
  • 2
  • 25
  • 57
7
votes
5 answers

dateutil 2.5.0 is the minimum required version

I'm running the jupyter notebook (Enthought Canopy python distribution 2.7) on Mac OSX (v 10.13.6). When I try to import pandas (import pandas as pd), I am getting the complaint: ImportError: dateutil 2.5.0 is the minimum required version. I have…
user1745564
  • 159
  • 1
  • 2
  • 8
7
votes
3 answers

customize dateutil.parser century inference logic

I am working on old text files with 2-digit years where the default century logic in dateutil.parser doesn't seem to work well. For example, the attack on Pearl Harbor was not on dparser.parse("12/7/41") (which returns 2041-12-7). The buit-in…
C8H10N4O2
  • 18,312
  • 8
  • 98
  • 134
7
votes
2 answers

Python error importing dateutil

I try to execute marathon-lb.py and it throws the next error: Traceback (most recent call last): File "./marathon_lb.py", line 46, in import dateutil.parser ImportError: No module named 'dateutil' I just install python with apt and…
Asier Gomez
  • 6,034
  • 18
  • 52
  • 105
7
votes
1 answer

Check if datetime string is in ISO 8601 format

I like to parse datetime strings with dateutil.parser.parse module. It's simple. However I noticed in my code that I have to check if the object is indeed in 8601 (and aware). My structure is: if parse(datetime).tzinfo==None: #do something else: …
Diolor
  • 13,181
  • 30
  • 111
  • 179
7
votes
2 answers

Get all available timezones

I'm currently working on an application that is required to support multiple timezones. For that, I'm using the dateutil library. Now, I need a way to present the user a list of all available timezones the dateutil library supports. Also, is it…
Vincent
  • 2,342
  • 1
  • 17
  • 22
6
votes
1 answer

dateutil.parser.parse() gives error "initial_value must be unicode or None, not str" on Windows platform

I'm sure there's a really simple solution to this, but I'm still fairly new to Python. I'm trying to use dateutil.parser.parse() to parse a string with a timestamp in it: >>> import dateutil.parser >>> a = dateutil.parser.parse("2011-10-01…
Steve Criddle
  • 163
  • 2
  • 7
6
votes
1 answer

Getting timezone from dateutil.parser.parse in Python

Trying to parse the datetime string with timezone info and get the utc offset from dateutil.parser import parse as parse_date s = '2017-08-28 06:08:20,488 CDT' dt = parse_date(s) print(dt.utcoffset()) # prints `None` Why is utcoffset returning…
frazman
  • 32,081
  • 75
  • 184
  • 269
6
votes
3 answers

python - locale in dateutil / parser

I set locale.setlocale(locale.LC_TIME, ('de', 'UTF-8')) the string to parse is: Montag, 11. April 2016 19:35:57 I use: note_date = parser.parse(result.group(2)) but get the following error: Traceback (most recent call last): File…
f0rd42
  • 1,429
  • 4
  • 19
  • 30
1 2
3
28 29