[Zope] Last day of Month
Eric Walstad
Eric@Walstads.net
Tue, 12 Dec 2000 08:20:42 -0800
Hi Paolo,
I have a Python Metho... er Python Script that I use that tells me the days
in each month. You pass in a Zope DateTime object as a parameter and it
returns the days in that month:
Parameters: ZopeDateTime
Code:
-----8<-- Start Snip --8<-----
if ZopeDateTime.isLeapYear():
intDaysInFebruary = 29
else:
intDaysInFebruary = 28
strMonthName=ZopeDateTime.Month()
dicDaysPerMonth =
{'January':31,'February':intDaysInFebruary,'March':31,'April':30,'May':31,'J
une':30,'July':31,'August':31,'September':30,'October':31,'November':30,'Dec
ember':31}
return dicDaysPerMonth.get(strMonthName, 0)
-----8<-- End Snip --8<-----
Hope that helps.
Eric.
-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Paolo
Quaglia
Sent: Tuesday, December 12, 2000 4:05 AM
To: zope@zope.org
Subject: [Zope] Last day of Month
Hi everibody
Is there some tricky way to know the last day of the month of a DateTime
object?
for ex: if my DateTime object is 12/12/2000 .... is there a method or a
function that return the last day of the month? (in this example 31)
Thanks a lot
Paolo Quaglia
Information Technology Coordinator
Sitek S.p.A.
paolo@sitek.it