problems playing with dates from any month.

Ian Clark iclark at mail.ewu.edu
Thu Aug 2 13:42:59 EDT 2007


krishnakant Mane wrote:
> hello,
> I have a very strange problem and I can't find any solution for that.
> I am working on an accounting package which I wish to develop in python.
> the simple problem is that I want to knoe how I can know if the given
> date is the nth day of a month.
> for example if a customer is supposed to pay his installment on every
> 5th of all months,
> I want to know if today is the fifth day (jan the fifth, feb the fifth
> etc) for any given month.
> I have not found any such function.
> if I have looked (or over looked ) in the wrong places I am really sorry.
> secondly I also want to know the way in which I can convert a given
> string to a date object.
> for example if I have a string "29/09/2005", I know it is a valid date
> although it is in a string form.
> now I want to convert the above string into a real date object.
> how can I cast it this way?
> regards,
> Krishnakant.

http://docs.python.org/lib/node85.html

Then it's just:

if date_obj.day == 5:
     print 'It's the fifth day of the month'

Ian




More information about the Python-list mailing list