Before you export from excel, you should be able to set your date field
format to something that will work, for example, in  format cells -> number
-> Custom
set the field to yyyy-mm-dd hh:mm:ss

That matches what you are saying the field "should be", and excel should
then export in this format to csv.

- Yarko

On Tue, Mar 31, 2009 at 8:04 AM, mdipierro <mdipie...@cs.depaul.edu> wrote:

>
> The problem is that web2py has not way of knowning is excel is set to
> US or EU date format.
>
> On Mar 31, 4:26 am, Fran <francisb...@googlemail.com> wrote:
> > My Database Table (sqlite) not readable in Web2Py if I CSV import a
> > bad date!
> >
> > Field format in CSV should be: 2009-03-31 10:46:51
> > Excel converts this silently to: 31/03/2009 10:46
> >
> > The record gets imported into DB but then a query on this table gives:
> >
> > Traceback (most recent call last):
> >   File "C:\Bin\web2py\gluon\restricted.py", line 98, in restricted
> >     exec ccode in environment
> >   File "C:\Bin\web2py\applications\sahana/views/default/
> > appadmin.html", line 324, in <module>
> >   File "C:\Bin\web2py\gluon\sqlhtml.py", line 614, in __init__
> >     for (rc, record) in enumerate(sqlrows):
> >   File "C:\Bin\web2py\gluon\sql.py", line 2116, in __iter__
> >     yield self[i]
> >   File "C:\Bin\web2py\gluon\sql.py", line 2071, in __getitem__
> >     str(value)[:10].strip().split('-')]
> > ValueError: invalid literal for int() with base 10: '31/03/2009'
> >
> > Whilst Excel is obviously being bad here, is there any way web2py can
> > be made more tolerant of such issues?
> > (Excel will commonly be used to prepare data from a foreign source to
> > be suitable for importing into an application)
> >
> > F
> >
>

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

Reply via email to