Re: [Zope] Last day of Month

2000-12-13 Thread Jose Soares

Use an External Method like this one.

# Perché non usare un metodo esterno?
from DateTime import Date
def lastDay(year,month):
try:
last = Date(year,month+1,1)-1
return last.day
except:
return 31


José

Eric Walstad wrote:

 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Paolo
 Quaglia
 Sent: Tuesday, December 12, 2000 4:05 AM
 To: [EMAIL PROTECTED]
 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.
 [EMAIL PROTECTED]

 ___
 Zope maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists -
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope-dev )


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] Last day of Month

2000-12-12 Thread Paolo Quaglia



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 QuagliaInformation Technology 
CoordinatorSitek S.p.A.[EMAIL PROTECTED] 



RE: [Zope] Last day of Month

2000-12-12 Thread Eric Walstad

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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Paolo
Quaglia
Sent: Tuesday, December 12, 2000 4:05 AM
To: [EMAIL PROTECTED]
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.
[EMAIL PROTECTED]


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )