Problem save datetime

51 views
Skip to first unread message

Alessio Varalta

unread,
May 18, 2016, 12:55:57 PM5/18/16
to web...@googlegroups.com
Hi i have this table

db.define_table('verbale',
            Field('partecipants',label=T('Partecipanti'),type="text",requires=IS_LENGTH(3000)),
            Field('date_verbale_start',label=T('Data inizio'),type="datetime",requires=IS_DATETIME('%Y-%m-%d %H:%M:%S')),
            Field('date_verbale_end',label=T('Data fine'),type="datetime",requires=IS_DATETIME('%Y-%m-%d %H:%M:%S')),
        )

I send to my controller a json, I retrieve the fields and create new row but I have this error

ValueError: invalid literal for int() with base 10: '24/05/2016'

This is my json

{"date_start":"25/05/2016 19:25:50","date_end":"27/05/2016 19:25:52"}
Why?

Dave S

unread,
May 18, 2016, 2:54:56 PM5/18/16
to web2py-users
Which db engine are you using?  Also, the date format in your JSON input doesn't match that in the requires specification, and should be failing the validator.

/dps
 

Alessio Varalta

unread,
May 20, 2016, 5:18:30 AM5/20/16
to web2py-users
I see the error..the define field i correct ..the error is in my controller :) resolved
Reply all
Reply to author
Forward
0 new messages