Really, the overcomplication is just for aesthetics, to avoid displaying 
00:00:00 on forms and in the widget.  The field settings I have seem to 
work well, so I'll just splat them into all necessary fields.

On Saturday, February 15, 2014 1:27:30 PM UTC, Niphlod wrote:
>
> why the overcomplication ? as other backends that don't support date every 
> date field in DAL gets turned to a datetime (with 0 hours, minutes and 
> seconds) and it's automatically handled.
>
> On Wednesday, February 12, 2014 6:31:06 PM UTC+1, Tim Nyborg wrote:
>>
>> I'm connecting to an MSSQL 2005 db, which only has the Datetime format 
>> (Date was added in 2008).
>> Is there a standard way to treat a Datetime as a Date in web2py for forms 
>> and formatting?
>>
>> I've done the following, and it works thus far, but it seems a bit 
>> hackish.
>> Field('BirthDte', 'datetime',
>>         widget=SQLFORM.widgets.date.widget,
>>         requires=IS_DATE(),
>>         represent = lambda value, row: value.strftime("%#d %b %Y"))
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to