I've never done this, but it seems to me it would be nice to set up the days
per month in a little hash table.

%calendarDays (
january => 31,
february => 28,
....
)
#or should the order be reversed? I'm not that familiar with Hashes.

Then have a check in there that grabs the date (see previous emails on
localtime to get date). if the year is divisible by 4, then the value for
Febrary would be 29 instead of 28. (there is probably a cleaner way, but
here is an untested idea..)

$yearCheck = $year / 4;
if ( $yearCheck = int $yearCheck ) { $calendar{'february'} = 29 }

$yearCheck divides the year by 4, and then checks to see if it is an
integer.  If it is, then change February's days to 29. I did not test this,
and I am a newbie, so take it for what it is.

-Frank

-----Original Message-----
From: Darryl Schnell [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 29, 2002 11:24 AM
To: [EMAIL PROTECTED]
Subject: Remain Days of Month & Leap Year Question


Greeting's All,

I am currently working on a prorate billing routine for an online form and
need a bit of guidance. The idea behind the program is to take 19.95 and
divde that by the total of remain days in the month, using the day of the
month the user filled out the form as the starting point. 

Getting the Day of Sign-Up and Calculating the cost I can handle, what I'm
not sure how to accomplish is how do I get the total of remaining days in
the month, how do I determine how many days that month has, and how do I
take into account Leap Years?

I relaize that this should be a basically simple matter so if any one has
some documentation that I could read that might help me figure this out I
would appreciate a shove in that direction. I tried doing a search on the
web and found some Calculating Date information but was still left alittle
foggy.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to