Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

holidays... how do you handle them? 1

Status
Not open for further replies.

ivow

Programmer
Aug 6, 2002
55
CA
I've just created a B2B online ordering system that crosses three four time zones. And I've created code that automatically flips the order date to the next day after 4:30 pm. And if it's Friday, it flips the order date to Monday and so on...

But now I'm faced with a challenge over holidays. Do I need to code each holiday in manually? Is there a logic I can apply for the major ones? How do you guys handle this kind of stuff?

Would I have to create a database of all the holidays from now until eternity?


This one has me stumped.

ivo "If it's stupid but works, it isn't stupid."
 
I suppose the best way would be to hardcode all the most common holidays (Christmas, Easter etc.) and also create a admin system where the user could enter holiday dates manually into the database. Obviously this has the downfall of needing someone to constantly monitor and add new holiday dates, but I don't think there's really another way around it! Nick (Software Developer)


nick@retrographics.fsnet.co.uk
nick.price@myenable.com
 
>> but I don't think there's really another way around it!

I have had some success doing this with a database using a re-occurring dates model. I would have to look at it to be sure but I think the only one I couldn't find a pattern for was Easter, but that doesn't mean there isn't one just that I couldn't figure it out. :)

Basically you break re-occurring dates down into the patterns then design your table to encapsulate the patterns. Then what you have is each row defines a re-occurring dates data which can be used to calculate the future dates until...

You still have to write the code that will calculate the dates from the data, but you only have to do it once for each holiday or yearly event like birthdays etc.

Hope this helps
-pete


 
craigey, YOU DA MAN
[2thumbsup]B-)
YOU DA MAN
[rockband]
YOU DA MAN
[elephant2][yoda][cheers][flip]

Thanks
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top