Exception Value: day is out of range for month

4,329 views
Skip to first unread message

Eric Keefauver

unread,
Mar 30, 2010, 10:01:17 AM3/30/10
to geod...@googlegroups.com
I am receiving the error "day is out of range for month" for the date of June  30th 2009 formatted  as a date value in the following manner:  06-30-2009 all other dates in this format work.

Is this a bug?


The Traceback:

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/data?date=06-30-2009&variable=speed
Django Version: 1.2 beta 1 SVN-12803
Python Version: 2.6.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.gis',
 'main',
 'rangerIII',
 'olwidget']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/usr/local/django/trunk/django/core/handlers/base.py" in get_response
  100.                     response = callback(request, *callback_args, **callback_kwargs)
File "/home/ekeefauver/projects/GLOS_outreach/hg/GLOS_outreach/main/views.py" in display_data
  177.     records=get_points_QS(filter_list)
File "/home/ekeefauver/projects/GLOS_outreach/hg/GLOS_outreach/rangerIII/views.py" in get_points_QS
  29.                     enddate=datetime.datetime(int(datelist[2]),int(datelist[0]),1+int(datelist[1]))

Exception Type: ValueError at /data
Exception Value: day is out of range for

Guillaume Sueur

unread,
Mar 30, 2010, 10:03:35 AM3/30/10
to geod...@googlegroups.com
I think it comes from

enddate=datetime.datetime(int(datelist[2]),int(datelist[0]),1+int(datelist[1]))

where you add 1 to the date. 31st of june doesn't exist.

Regards

Guillaume

Le 30/03/2010 16:01, Eric Keefauver a ᅵcrit :

> --
> You received this message because you are subscribed to the Google
> Groups "geodjango" group.
> To post to this group, send email to geod...@googlegroups.com.
> To unsubscribe from this group, send email to
> geodjango+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/geodjango?hl=en.

Eric Keefauver

unread,
Mar 30, 2010, 11:02:28 AM3/30/10
to geod...@googlegroups.com
Guillaume,

Thank you!

Code changed to:
enddate = date + datetime.timedelta(days=1)

which seems to have solved the issue

Again thank you and regards

On Tue, Mar 30, 2010 at 10:03 AM, Guillaume Sueur <no-r...@neogeo-online.net> wrote:
I think it comes from
enddate=datetime.datetime(int(datelist[2]),int(datelist[0]),1+int(datelist[1]))

where you add 1 to the date. 31st of june doesn't exist.

Regards

Guillaume




--
EK

Guillaume Sueur

unread,
Mar 30, 2010, 12:34:12 PM3/30/10
to geod...@googlegroups.com
Your welcome. Note that I didn't bring any solution myself !

Best regards

Guillaume

Le 30/03/2010 17:02, Eric Keefauver a ᅵcrit :


> Guillaume,
>
> Thank you!
>
> Code changed to:
> enddate = date + datetime.timedelta(days=1)
>
> which seems to have solved the issue
>
> Again thank you and regards
>
> On Tue, Mar 30, 2010 at 10:03 AM, Guillaume Sueur
> <no-r...@neogeo-online.net <mailto:no-r...@neogeo-online.net>> wrote:
>
> I think it comes from
> enddate=datetime.datetime(int(datelist[2]),int(datelist[0]),1+int(datelist[1]))
>
> where you add 1 to the date. 31st of june doesn't exist.
>
> Regards
>
> Guillaume
>

> Le 30/03/2010 16:01, Eric Keefauver a ᅵcrit :

> <mailto:geod...@googlegroups.com>.


> > To unsubscribe from this group, send email to
> > geodjango+...@googlegroups.com

> <mailto:geodjango%2Bunsu...@googlegroups.com>.


> > For more options, visit this group at
> > http://groups.google.com/group/geodjango?hl=en.
>
> --
> You received this message because you are subscribed to the Google
> Groups "geodjango" group.
> To post to this group, send email to geod...@googlegroups.com

> <mailto:geod...@googlegroups.com>.


> To unsubscribe from this group, send email to
> geodjango+...@googlegroups.com

> <mailto:geodjango%2Bunsu...@googlegroups.com>.


> For more options, visit this group at
> http://groups.google.com/group/geodjango?hl=en.
>
>
>
>
> --
> EK
>

Reply all
Reply to author
Forward
0 new messages