much simpler. :-)

db.FEDEXFORM.FFNSD.default =  datetime.datetime.strptime(jj.J2NSD,'%Y%m%d')

On Wednesday, 2 November 2011 10:19:39 UTC-5, Omi Chiba wrote:
>
> This is more like python question but 
>
> jj.J2NSD is integer and has value = 20111130 (YYYYMMDD) 
>
> I want to set the value as default value of FFNSD which is 'date' 
> type. 
>
> Field('FFNSD', 'date'), 
>
> I think I need to import datetime and convert from integer or stiring. 
> Is anyone know easy way to do it ? 
>
>
> This doesn't work because it set string to date... 
>
> db.FEDEXFORM.FFNSD.default = str(jj.J2NSD)[0:4]+"-"+str(jj.J2NSD) 
> [4:6]+"-"+str(jj.J2NSD)[6:8]

-- 
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/d/optout.

Reply via email to