[Plone-IT] estrarre anno da DateTime

Fabrizio Rota fabrizio.rota a gmail.com
Ven 11 Dic 2009 17:21:26 UTC


Con il codice di ploneformgen

anno_intero = form['data-emissione'].year()
anno = str(anno_intero)

(ove data-emissione č un campo pfg di tipo "data") ho l'errore

Exception Type AttributeError  Exception Value 'str' object has no attribute
'year'
Praticamente č come se pfg trasformasse il campo data in una stringa.
Allora mi son detto:
"sto a farmi troppi problemi, estraggo i primi 4 caratteri dalla
stringa"..... ma sbuca altro errore e non funge.
Non mi funge nemmeno il metodo suggerito da Vito.

Che stresssssssssss

Grazie the same.

faber

Il giorno 11 dicembre 2009 15.26, Davide Moro <davide.moro a redomino.com> ha
scritto:

> Il giorno ven, 11/12/2009 alle 15.10 +0100, Fabrizio Rota ha scritto:
> > Raccolgo un DateTime con un form.
> > Vorrei estrarre l'anno e trattarlo come stringa.
> > Č possibile? Come?
>
> Ciao,
> dovresti cavartela cosė:
> xxx.year()
>
> Cosė ti torna un intero, se vuoi una stringa fai str(anno) e dovrebbe
> essere ok.
>
> --
> Davide Moro
>
> Redomino S.r.l.
> Largo Valgioie 14,
> 10146 Torino Italy
> Tel: +39 0117499875
> http://redomino.com
>
>
>
> _______________________________________________
> Plone-IT mailing list
> Plone-IT a lists.plone.org
> http://lists.plone.org/mailman/listinfo/plone-it
> http://www.nabble.com/Plone---Italy-f21728.html
>



-- 
Fabrizio
--------------------
"Life is what happens to you while you're busy making other plans" - J.
Lennon
-------------- parte successiva --------------
Un allegato HTML č stato rimosso...
URL: <http://lists.plone.org/pipermail/plone-plone-it/attachments/20091211/4857f853/attachment.html>


Maggiori informazioni sulla lista Plone-IT