There is
{{=(concert.concert_date.strftime(str(T("%Y-%m-%d"))))}}
On Sunday, 16 March 2014 04:50:42 UTC-5, Gael Princivalle wrote:
>
> Of course like that it works fine:
> {{=(concert.concert_date.strftime("%d/%m/%Y"))}}
>
> But I was thinking there was a way to do that with T().
>
>
> Il giorno domenica 16 marzo 2014 10:09:20 UTC+1, Gael Princivalle ha
> scritto:
>>
>> Hi all.
>>
>> So, I save my date like that in my table:
>> db.define_table('concerts',
>> Field('concert_date', type='date', requires = IS_DATE(
>> format='%Y-%m-%d'))...
>>
>> My controller for displaying one record:
>> def concert():
>> id_concert = request.vars['id']
>> concert = db.concerts(id_concert)
>> return dict(concert=concert)
>>
>> My view:
>> <tr class='concert-tr'>
>> {{if request.uri_language=='it':}}
>> <th>{{=(concert.concert_date)}}</th>
>> <th>{{=(concert.city)}}</th>
>> <th>{{=(concert.title_it)}}</th>
>> {{else:}}
>> <th>{{=(concert.concert_date)}}</th>
>> <th>{{=(concert.city)}}</th>
>> <th>{{=(concert.title_en)}}</th>
>> {{pass}}
>> </tr>
>>
>> {{=(concert.concert_date)}}
>> display the %Y-%m-%d format.
>>
>> I've expect that :
>> {{=T(concert.concert_date)}}
>> with the italian URI will display the date in italian format, %d-%m-%Y but
>> web2py make this error:
>> cannot concatenate 'str' and 'datetime.date' objects
>>
>> How can I resolve that ?
>>
>> Thanks.
>>
>>
>>
>>
--
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.