Re: Working Days
This WebDNA talk-list message is from 2004
It keeps the original formatting.
numero = 58486
interpreted = N
texte = On 18 Jun 2004, at 2:40 pm, Joe D'Andrea wrote:> At 2:02 PM +0100 6/18/04, Mark Derrick wrote:>> This is a little rough, but it should do exactly what you need.>> (You'll need to use variable for the "Start" and "Stop" dates)>>>> [math show=f]Total_days={24/02/2004}-{01/02/2004}[/math]>> [math show=f]working-days=0[/math]>>>> [loop start=0&end=[Total_days]]>> [text show=f]day=[format days_to_date >> %a][math]{01/12/2003}+[index][/math][/format][/text]>> [If (("[day]"="Sat") | ("[day]"="Sun"))]>> [then][/then]>> [else][text >> show=f]working-days=[math][working-days]+1[/math][/text][/else]>> [/if]>> [/loop]>>>> Working days: [working-days]>> Why are you setting [text] variables to the result of [math] > operations in your [else] statement?>> Here's a smaller version (less engine processing) and it doesn't reply > of "if" contexts.>>> [text]startdate=02/01/2004[/text]> [text]enddate=02/24/2004[/text]>> [math show=f]workingdays=0[/math]>> [loop start=[math]{[startdate]}[/math]&end=[math]{[enddate]}[/math]]> [hideif |Sat|Sun|^[format days_to_date %a][index][/format]]> [math show=f]workingdays=[workingdays]+1[/math]> [/hideif]> [/loop]>> Working Days=[workingdays]>Sorry, I cut and pasted some of the code from other snippits I had, and I forgot to change the [text] variable.I always tend to code "long-hand" and then see how many lines I can reduce it to :-)I think this is about has small as it's going to get - the [loop {date}] method is very smart.Mark.-------------------------------------------------------------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 Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
On 18 Jun 2004, at 2:40 pm, Joe D'Andrea wrote:> At 2:02 PM +0100 6/18/04, Mark Derrick wrote:>> This is a little rough, but it should do exactly what you need.>> (You'll need to use variable for the "Start" and "Stop" dates)>>>> [math show=f]Total_days={24/02/2004}-{01/02/2004}[/math]>> [math show=f]working-days=0[/math]>>>> [loop start=0&end=[Total_days]]>> [text show=f]day=[format days_to_date >> %a][math]{01/12/2003}+[index][/math][/format][/text]>> [If (("[day]"="Sat") | ("[day]"="Sun"))]>> [then][/then]>> [else][text >> show=f]working-days=[math][working-days]+1[/math][/text][/else]>> [/if]>> [/loop]>>>> Working days: [working-days]>> Why are you setting [text] variables to the result of [math] > operations in your [else] statement?>> Here's a smaller version (less engine processing) and it doesn't reply > of "if" contexts.>>> [text]startdate=02/01/2004[/text]> [text]enddate=02/24/2004[/text]>> [math show=f]workingdays=0[/math]>> [loop start=[math]{[startdate]}[/math]&end=[math]{[enddate]}[/math]]> [hideif |Sat|Sun|^[format days_to_date %a][index][/format]]> [math show=f]workingdays=[workingdays]+1[/math]> [/hideif]> [/loop]>> Working Days=[workingdays]>Sorry, I cut and pasted some of the code from other snippits I had, and I forgot to change the [text] variable.I always tend to code "long-hand" and then see how many lines I can reduce it to :-)I think this is about has small as it's going to get - the [loop {date}] method is very smart.Mark.-------------------------------------------------------------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 Web Archive of this list is at: http://webdna.smithmicro.com/
Mark Derrick
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:
Snake Bites (1997)
WebCatalog Features (1997)
PCS Frames (1997)
Q: Japanese Kanji code support? (2000)
mac hack (1997)
Cookies and domains (2006)
[append] problem (1997)
Re:2nd WebCatalog2 Feature Request (1996)
WebCat2b13MacPlugIn - [showif][search][/showif] (1997)
WebCAT has the devil in it! (2003)
[WebDNA] User sessions - cookies only or cookies and a sessions.db? (2016)
WebDNA Quick Reference (Reserved Words) (2000)
RE: Signal Raised (1997)
Server Freeze (1998)
WebCatalog NT beta 18 now available (1997)
Browser Problem?!? Still getting Error message using POST! (1997)
Sendmail and textarea (1998)
WebDNA Promo Sound Bite (2003)
Dates as 20020902 (2002)
Another reviewer 'forgets' NT WebCatalog (1998)