Re: Business Days from today.
This WebDNA talk-list message is from 2000
It keeps the original formatting.
numero = 26361
interpreted = N
texte = Sorry for taking so long bob....read my note on top to see why....[!]This code tells you how many days FROM today (but NOT counting today) it will actually take to be equivalent to m_numDays business days.If you want the code to count today as a possible day as well, modify the code accordinglyI've separated each of these items out so you can see it step by step. Combine for efficiency as necessary....SIDE NOTE:1. Why do I name my variables this way? To avoid confusion, add clarity, and avoid collision. As a habit, I code all form variables to begin with an underscore (_), all text variables to begin with a t_, and all math variables with a m_. In this way, I can avoid messy variable hierarchial problems if a form/math/text variable has the same name as a reserved word or database field.2. I was dissapointed that I couldn't initially figure out how to do this COMPLETELY mathematically....that's why I took so long to post. I know there is a way to do it without any showif's at all, so if I figure that one out, I'll post it. Sorry[/!][!]How many business days? Make this a form input or whatever ya need.[/!][math show=f]m_numDays=7[/math][!]Gets today's date and puts it into number of days from whatever that beginning date, whatever it is...[/!][math show=f]m_today={[date]}[/math][!]This decides how many FULL business weeks there are basked on the number of days asked, and multiplies that number by 2 days (per weekend). I floor in order to round the number down[/!][math show=f]m_mustAdd=(floor([m_numDays]/5))*2[/math][!]This figures out how many days are left in the current week before the weekend hits us[/!][math show=f]m_DaysLeft=5-[date %w][/math][!]Make a quick Adjustment[/!][showif [m_DaysLeft]<[m_numDays]][math show=f]m_mustAdd=m_mustAdd+2[/math][/showif][!]Spits out the the number of days you need to add to your current date (m_today) to get the real date you're actually looking for[/!][math][m_numDays]+[m_mustAdd][showif [m_numDays]\5]-2[/showif][/math][!]The date that is m_numDays business days from today[/!][format days_to_date %m/%d/%Y][math][m_today]+[m_mustAdd][/math][/format]At 02:23 PM 1/21/00 -0600, you wrote:>Any quickies for calcualating 3/5/7 business days from [date]?>>Robert Minor>Director of Internet Services>------------------------------------------------------------>Cybermill Communications>http://www.cybermill.com http://www.merchantmaker.com>>Providing Ecommerce and interactive website development and>hosting services on Macintosh, Windows NT, Unix, and AS/400.>>>------------------------------------------------------------->Brought to you by CommuniGate Pro - The Buzz Word Compliant Messaging Server.>To end your Mail problems go to
.>>This message is sent to you because you are subscribed to> the mailing list .>To unsubscribe, E-mail to: >To switch to the DIGEST mode, E-mail to >===============================================Howard WoloskyLead Programmer / WebmasterLab2K, LLC+The Pubb - The best solution for your messageboard needs. Written in 100% Webcat. (www.thepubb.com)+Will It Work? -The World's Largest Year 2000 Compliance Search Engine (www.willitwork.com)===============================================-------------------------------------------------------------Brought to you by CommuniGate Pro - The Buzz Word Compliant Messaging Server.To end your Mail problems go to .This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to
Associated Messages, from the most recent to the oldest:
Sorry for taking so long bob....read my note on top to see why....[!]This code tells you how many days FROM today (but NOT counting today) it will actually take to be equivalent to m_numDays business days.If you want the code to count today as a possible day as well, modify the code accordinglyI've separated each of these items out so you can see it step by step. Combine for efficiency as necessary....SIDE NOTE:1. Why do I name my variables this way? To avoid confusion, add clarity, and avoid collision. As a habit, I code all form variables to begin with an underscore (_), all text variables to begin with a t_, and all math variables with a m_. In this way, I can avoid messy variable hierarchial problems if a form/math/text variable has the same name as a reserved word or database field.2. I was dissapointed that I couldn't initially figure out how to do this COMPLETELY mathematically....that's why I took so long to post. I know there is a way to do it without any showif's at all, so if I figure that one out, I'll post it. Sorry[/!][!]How many business days? Make this a form input or whatever ya need.[/!][math show=f]m_numDays=7[/math][!]Gets today's date and puts it into number of days from whatever that beginning date, whatever it is...[/!][math show=f]m_today={[date]}[/math][!]This decides how many FULL business weeks there are basked on the number of days asked, and multiplies that number by 2 days (per weekend). I floor in order to round the number down[/!][math show=f]m_mustAdd=(floor([m_numDays]/5))*2[/math][!]This figures out how many days are left in the current week before the weekend hits us[/!][math show=f]m_DaysLeft=5-[date %w][/math][!]Make a quick Adjustment[/!][showif [m_DaysLeft]<[m_numDays]][math show=f]m_mustAdd=m_mustAdd+2[/math][/showif][!]Spits out the the number of days you need to add to your current date (m_today) to get the real date you're actually looking for[/!][math][m_numDays]+[m_mustAdd][showif [m_numDays]\5]-2[/showif][/math][!]The date that is m_numDays business days from today[/!][format days_to_date %m/%d/%Y][math][m_today]+[m_mustAdd][/math][/format]At 02:23 PM 1/21/00 -0600, you wrote:>Any quickies for calcualating 3/5/7 business days from [date]?>>Robert Minor>Director of Internet Services>------------------------------------------------------------>Cybermill Communications>http://www.cybermill.com http://www.merchantmaker.com>>Providing Ecommerce and interactive website development and>hosting services on Macintosh, Windows NT, Unix, and AS/400.>>>------------------------------------------------------------->Brought to you by CommuniGate Pro - The Buzz Word Compliant Messaging Server.>To end your Mail problems go to .>>This message is sent to you because you are subscribed to> the mailing list .>To unsubscribe, E-mail to: >To switch to the DIGEST mode, E-mail to >===============================================Howard WoloskyLead Programmer / WebmasterLab2K, LLC+The Pubb - The best solution for your messageboard needs. Written in 100% Webcat. (www.thepubb.com)+Will It Work? -The World's Largest Year 2000 Compliance Search Engine (www.willitwork.com)===============================================-------------------------------------------------------------Brought to you by CommuniGate Pro - The Buzz Word Compliant Messaging Server.To end your Mail problems go to .This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to
Howard Wolosky
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
[WebDNA] feature requests (2008)
[WebDNA] Another strange WebDNA problem (2013)
email bounce check (2002)
Renaming textA (1998)
[OT] Site Check please (2006)
Multiple prices (1997)
Possible Bug in 2.0b15.acgi (1997)
Summary layout (1997)
Adding Multiple Items to Shopping Cart from a Resultspage (1997)
Total number (2004)
WC2b12: Yes, Formulas.db is for real (1997)
f2 download problems (1997)
WebTen and WebCat (1997)
What file? (1997)
Trunk-gator (1997)
Missing contexts on NT (1997)
WebDNA 4.5.1 Now Available (2003)
oops private message leaked into talk list (1997)
WebCat2 - Getting to the browser's username/password data (1997)
Bug in 4.5 - Needs to be fixed ASAP. (2002)