Number of days in month from certain parameters, c programming request.

Hi,
I have an issue in date processing, the issue is I have a month as an int ( 1 - 12 ), the weekday as int ( 0 - 6 , 0 = Sunday), and the week day in month as int ( 0 - 5, 5 = last ex: first sunday, last monday, third tuesday ... ), now from those three parameters is there a possible way to calculate the number of days since the start of this month ( ex: 23 days has passed from the start of this month for the given parameters ).
Please, if anyone knows a way to do it tell me.
ex: the date of the current day is 26 08 2010
the given data is: month = 8, weekday = 4 thursday, and weekday of month = 3 4th thursday. And from these three data pieces the result is 26 days passed since the start of month #8 of the current year.
Thanks.

Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.

Here is a solution which works for the ksh93 shell

#!/bin/ksh93

year=2010
month=8
dow=4
wom=3

mstr=(jan feb mar apr may jun jul aug sep oct nov dec)
dstr=(sun mon tue wed thu fri sat)
wstr=(1st 2nd 3rd 4th 5th)

dom=$(printf "%(%d)T\n" "${wstr[$wom]} ${dstr[$dow]} ${mstr[$month - 1]} ${year}")

printf "Day of month is: $dom\n"