Day of Year Behaviour

Gerardo Herzig -Departamento de Proyectos Especiales e Internet- Facultad de Medicina gherzig at fmed.uba.ar
Fri Oct 1 22:13:41 CEST 2004


well, normalDate will help you here. I think normalDate is not in python 
standart ditribution, but it is a pretty nice peace or work.

YEAR = 2004
DAY_OF_YEAR = 40
import normalDate
date = normalDate.ND('%s0101' % YEAR) + DAY_OF_YEAR
print date.formatUS()
-> '02/10/04'
normalDate have more methods (most of them are simple formateed prints)

Gerardo.


> Hi all!
> I have 2 fields:
> YEAR
> DAY_OF_YEAR
>
> and I need to get the complete date out of this, e.g.:
> YEAR=2004
> DAY_OF_YEAR=1
> -> DATE=2004/Jan/1
>
> YEAR=2004
> DAY_OF_YEAR=33
> -> DATE=2004/Feb/2
>
> I'm using the time module without success:
> >>> time.localtime(time.mktime((2004, 0, 0, 0, 0, 0, 0, 1, 0)))
>
> (2003, 11, 30, 0, 0, 0, 6, 334, 0)
>
> Any suggestions? Thanks in advance!
> Hector Villafuerte

-- 
Gerardo Herzig
Departamento de Proyectos Especiales e Internet
Facultad de Medicina
U.B.A.



More information about the Python-list mailing list