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

Price per date database design for hotel reservation system (store each date vs calcul it at runtime)

I have a requirement similar to this question, I need to store prices per date (prices change seasonally) and I have designed the bellow model: room_calendar : room_id : date : price: I must store dates up ~one year…
LuisSolis
  • 358
  • 3
  • 11
0
votes
0 answers

Why does relativedelta remove more than 1 month when i do months=-1?

I have the last day of the month, in this case 30th June 2020, and I am trying to change it to 1st June 2020. What I did is this end_date + relativedelta(days=+1, months=-1) but what it returns is May 31st 2020, when I want June 1st 2020. I…
jason
  • 562
  • 8
  • 24
0
votes
1 answer

python parse date string with out of range days without error

I want to parse a date string and manipulate the year, month, date in cases where I either get '00' for month or day or in cases where I get a day beyond the possible days of that year/month. Given a '2012-00-00' or a '2020-02-31', I get a…
DizzyDawg
  • 1
  • 1
0
votes
1 answer

TypeError passing Series with dtype int to dateutil.relativedelta

I'm trying to use dateutil.relativedelta.relativedelta to add an int type pandas Series to a datetime Series. df.loc[:,'calc_eli_date'] = ( datetime.datetime(df['pol_eff_date']) +…
mccambe
  • 11
  • 4
0
votes
2 answers

How to covert simple date-string to ISO-date format in python?

I'm able to convert ISO-date format to simple date format as below. from dateutil.parser import parse date_string = '2018-03-12T10:12:45Z' dt = parse(date_string) print(dt.date()) #prints 2018-03-12 print(dt.time()) #prints…
StackGuru
  • 471
  • 1
  • 9
  • 25
0
votes
0 answers

dateutil tz.datetime_ambiguous() function throws Value Error

I have a list of start and end times data of bike rides. Below are the first 5 entries of the list. onebike_datetimes[0:4] [{'start': datetime.datetime(2017, 10, 1, 15, 23, 25, tzinfo=tzfile('US/Eastern')), 'end': datetime.datetime(2017, 10, 1,…
Srinivas
  • 568
  • 1
  • 4
  • 21
0
votes
1 answer

Python add user specified days/months/years to today

I am trying to add x number of days or months or years to today’s date, where both x and the frequency are supplied by the user. I have looked at dateutil.relativedelta but since it doesn’t accept a string as a parameter, where I could have perhaps…
PyNance
  • 3
  • 3
0
votes
2 answers

How to Have Python Make a Variable with a Data Two Years Ago from Todays Date

So I need to make a variable in python to have it send off today's date two years ago. I am having to automate a report in Salesforce using Selenium and need to have the form created by a send.keys() method from a variable. The variable I have for…
R. Barrett
  • 685
  • 11
  • 34
0
votes
2 answers

Listings days and hours in a 2D list using python

I want to list all dates and hours between 2 given inout datetimes using dateutil library. Example: input: date_from= 02/16/2020:00:00:00, date_to = 02/17/2020:00:00:00 I want to have a list with the below structure 02/16/2020,…
Mo T
  • 440
  • 2
  • 9
  • 30
0
votes
2 answers

Number of days between today and a negative year ("-2580,01,01", today")

I need to calculate the number of days between two dates. One will be today and the other one is -2580,01,01. I have tried with the datetime library but I can't because the datetime library don't accept negative years (MIN=1, MAX=9999). I have tried…
0
votes
1 answer

AttributeError: 'datetime.datetime' object has no attribute 'write'

Im trying to convert a str to a date object using the python-dateutil library from dateutil.parser import * datetime_object = parse('Fri Feb 14 19:39:51 +0000 2020') pprint("DATETIME", datetime_object ) However i get the following…
Kay
  • 17,906
  • 63
  • 162
  • 270
0
votes
1 answer

dateutil conflict with django

Here is the question: an error occurs when I import pandas: dateutil: No module named 'dateutil' So i installed dateutil, which is successfully installed, with pip: pip3 install python-dateutil but when i run my django project i got error like…
Fenglin Wang
  • 93
  • 1
  • 1
  • 3
0
votes
1 answer

Python method to create a dateutil.relativedelta.relativedelta object from a dict

I'm using the following method to create the object stated in the title: from dateutil import relativedelta MA_dict = {'years': 0, 'months': 0, 'weeks': 0, 'days': 1, 'hours': 0, 'minutes': 0, …
cheesus
  • 1,111
  • 1
  • 16
  • 44
0
votes
2 answers

Get day name from starting date

I developing a course app. In my app, if a student register for a new course, the teacher must input the starting course date for the student. And in this app, the student can pick up the day that they want to learn to the teacher. e.g: The student…
Tri
  • 2,722
  • 5
  • 36
  • 65
0
votes
1 answer

How to extract date from a python string

I want to extract a date from a string using python's dateutil package. The date comes in different formats, but the day part of the date is not present in any one of these string. Month when written in Alphabets preceeds year like Sep 2016, but…
cph_sto
  • 7,189
  • 12
  • 42
  • 78