You can do db.table.field.requires = IS_DATE(format = '%D-%M-%Y')
this can be done globally or in one action only. It will affect forms. You also need to change the format in JS calendar. This is in the code in web2py_ajax.html: <script type="text/javascript"><!-- // These variables are used by the web2py_ajax_init function in web2py_ajax\ .js (which is loaded below). var w2p_ajax_confirm_message = "{{=T('Are you sure you want to delete this \ object?')}}"; var w2p_ajax_date_format = "{{=T('%Y-%m-%d')}}"; var w2p_ajax_datetime_format = "{{=T('%Y-%m-%d %H:%M:%S')}}"; var ajax_error_500 = '{{=XML(T('An error occured, please %s the page') % A(\ T('reload'), _href=URL(args=request.args, vars=request.vars))) }}' //--></script> If you want the format to change only in one action/form you need some if statement in there. On Thursday, 17 January 2013 20:18:59 UTC-6, Tim Richardson wrote: > > > > On Thursday, 17 January 2013 14:56:51 UTC+11, Massimo Di Pierro wrote: >> >> Does this help? >> http://web2py.com/books/default/chapter/29/03#On-date,-datetime-and-time-format >> >> > My little problem was that I'm using some legacy code, which wanted dates > as strings in dd-mm-yyyy. The date picker returns strings yyyy-mm-dd. > Mostly in my app, yyyy-mm-dd is exactly ok, but there is this one instance > where dd-mm-yyyy is required. So I wondered if there was an easy way to > change behaviour of the widget, one-time (so I don't want to change > application-wide defaults). The jquery docs suggest only javascript can do > it. In the end I just used datetime to convert it to a date and back to a > string in my required format. > > > > >> On Wednesday, 16 January 2013 21:24:06 UTC-6, Tim Richardson wrote: >>> >>> I'm using the date picker in a form by using _class='date' >>> Can I change the format of the string returned? >>> >>> --