Find day of week from month and year

Donn Cave donn at u.washington.edu
Fri Sep 2 15:45:45 EDT 2005


In article <1125688505.492837.199870 at g47g2000cwa.googlegroups.com>,
 "Laguna" <ed_zeng at yahoo.com> wrote:

> I want to find the expiration date of stock options (3rd Friday of the
> month) for an any give month and year. I have tried a few tricks with
> the functions provided by the built-in module time, but the problem was
> that the 9 element tuple need to be populated correctly. Can anyone
> help me out on this one?
...
> Requirements:
> 
> d0 = expiration(9, 2005) # d0 would be 16
> d1 = expiration(6, 2003) # d1 would be 20
> d2 = expiration(2, 2006) # d2 would be 17

What do you mean by, "the 9 element tuple need to be populated
correctly"?  Do you need someone to tell you what values it
needs?  What happens if you use (2005, 9, 1, 0, 0, 0, 0, 0, 0),
for example?  If you make this tuple with localtime or gmtime,
do you know what the 7th (tm[6]) element of the tuple is?
What tricks did you try, exactly?

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list