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:
Price recalc based on quantity (1997)
Search in 2 or more catalogs (1997)
Netscape v. IE (1997)
Here we go again... (2006)
Sendmail doesn't (was Queertrons?) (1997)
Help on how to store calculated value (2002)
BUG in [showif] using ^ (contains) (1997)
Fields font size (2003)
headers (2000)
Dropdown menus (2006)
WebCat name recognition (was MacFinder -- a new WebDNA web site) (1998)
off topic fetch vs PCS photomaster (1997)
Virtual Postcards (1998)
[Fwd: Rotating Banners ... (was LinkExchange)] (1997)
New public beta available (1997)
Bad URL reference? (1997)
Re:Copyright ? (1997)
Help with nested search (1998)
Hosts who have upgraded to v5.0? (2003)
Banner Ad example (Typhoon) and WebCatalog (1997)