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 <[email protected]> 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 > [email protected] > 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
_______________________________________________ Plone-IT mailing list [email protected] http://lists.plone.org/mailman/listinfo/plone-it http://www.nabble.com/Plone---Italy-f21728.html
