Il 13 aprile 2015 21:28, Gabriele Battaglia <iz4...@libero.it> ha scritto:

> Ma quanto sono vecchio in realtà? Pensavo di avere 40 anni, e 7 mesi, non
> 41.
> Cosa mi sfugge  e, come faccio a risalire ad una data, da un oggetto di tipo
> timedelta?

Ti sfugge che (purtroppo) l'anno 0  non esiste. Quello che ti ha
restituito è quella che sarebbe la data di oggi se tu avessi
esattamente la tua età, ma fossi nato il primo gennaio dell'anno 1 DC
(e ti chiamassi Gesù invece di Gabriele).

> Se scrivo infatti:
> date.fromordinal(d)
> La funzione restituisce un errore in quanto accetta interi e non oggetti
> timedelta.

In [11]: date.fromordinal(x.days)
Out[11]: datetime.date(41, 7, 31)

©

-- 
|:**THE BEER-WARE LICENSE** (Revision 42):
| <mi...@python.it> wrote this mail. As long as you retain
| this notice you can do whatever you want with this stuff.
| If we meet some day, and you think this stuff is worth it,
| you can buy me a beer in return.
|                                            --Carlo Miron :
_______________________________________________
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python

Rispondere a