Ok, my bad then. This would be correct then. Otherwise you get an error
time.strftime(fmt, (d.year, d.month, d.day, 0, 0, 0, 0, d.day, 0) 

If you don't add the Julian day, you get "ValueError: day of year out of
range"

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Paul McNett
Sent: 29. januar 2008 15:45
To: Dabo developers' list
Subject: Re: [dabo-dev] dates.py - getStringFromDate()

Simen Haugen wrote:

> The recent change (18jan) to dates.py getStringFromDate() breaks my
code
> 
>       return time.strftime(fmt, (d.year, d.month, d.day, 0, 0, 0, 0,
> 0, 0))
> 
> Should be
> 
>       return time.strftime(fmt, (d.year, d.month, d.day, 0, 0, 0,
> d.month, d.day, 0))


Hmm. Tuple items 6 and 7 are documented to be for weekday (0-6) and 
Julian Day (1-366). As these values don't have any bearing when 
converting dates from/to datetime.date and strings I thought leaving 
them at 0 was sufficient.

What breaks, specifically? And I wonder why sending the month and day 
again would fix it?

> It's also worth noting that it could be simpler by using (as the dates
> strftime supports the same)
> 
>       return d.strftime(fmt)


I was using d.strftime(fmt) however it suffered from not being able to 
deal with dates before 1900.


Paul

-- 
http://paulmcnett.com


[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/dabo-dev/[EMAIL PROTECTED]

Reply via email to