Re: Validating A Date
This WebDNA talk-list message is from 2004
It keeps the original formatting.
numero = 55626
interpreted = N
texte = I recently wrote exactly this, on a current=20project. It also checks for past dates. WebDNA=20formats for correct dates when going from math to=20a formatted style. When going the other way, from=20an impossible date, WebCat calculates the right=20number regardless (i.e., June 31 would render as=20if it were July 1).This snippet takes three incoming variables for the day, month, and year...[!]****** render dates from form input *******[/!][text]date1=3D[mo1]/[day1]/[yr1][/text]=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0==A0=A0[!]****** check for validity of dates *******************************[/!][!]****** If date1 is in 01/25/2004 format, *************************[/!][!]****** [math]{[date1]}[/math] --> 705432 *************************[/!][!]******=A0 format days_to_date %m/%d/%Y --> back to 01/25/2004 *******[/!=][!]** fails for Feb 31 ****[/!][showif [format days_to_date=20%m/%d/%Y][math]{[date1]}[/math][/format]![date1]][text]OK=3Dnot[/text][/show=if][!]** fails for past dates ****[/!][showif=20[math]{[date1]}[/math]<[math]{[date]}[/math]][text]OK=3Dnot[/text][/showif][showif [OK]=3Dnot]do what you need to do here to correct the=20problem. I show the form again pre-filled-out,=20with an error message.[/showif]TerryJustin Carroll wrote:I'm receiving a date from user input (i.e. 02/30/2004) and would like to =3Dvalidate it with webDNA. I'd like to check it against, one, if it even =3Dexists and two, if it even exists due to leap year. Does anyone have a =3Dpre-manufactured snippet to do this? Thanks.-------------------------------------------------------------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:
I recently wrote exactly this, on a current=20project. It also checks for past dates. WebDNA=20formats for correct dates when going from math to=20a formatted style. When going the other way, from=20an impossible date, WebCat calculates the right=20number regardless (i.e., June 31 would render as=20if it were July 1).This snippet takes three incoming variables for the day, month, and year...[!]****** render dates from form input *******[/!][text]date1=3D[mo1]/[day1]/[yr1][/text]=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0==A0=A0[!]****** check for validity of dates *******************************[/!][!]****** If date1 is in 01/25/2004 format, *************************[/!][!]****** [math]{[date1]}[/math] --> 705432 *************************[/!][!]******=A0 format days_to_date %m/%d/%Y --> back to 01/25/2004 *******[/!=][!]** fails for Feb 31 ****[/!][showif [format days_to_date=20%m/%d/%Y][math]{[date1]}[/math][/format]![date1]][text]OK=3Dnot[/text][/show=if][!]** fails for past dates ****[/!][showif=20[math]{[date1]}[/math]<[math]{[date]}[/math]][text]OK=3Dnot[/text][/showif][showif [OK]=3Dnot]do what you need to do here to correct the=20problem. I show the form again pre-filled-out,=20with an error message.[/showif]TerryJustin Carroll wrote:I'm receiving a date from user input (i.e. 02/30/2004) and would like to =3Dvalidate it with webDNA. I'd like to check it against, one, if it even =3Dexists and two, if it even exists due to leap year. Does anyone have a =3Dpre-manufactured snippet to do this? Thanks.-------------------------------------------------------------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/
Terry Wilson
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:
Workaround for Emailer doubled bcc messages (1998)
Out of the woodwork (2007)
Authenticate (1997)
Duplicate Cart ID (2001)
orderfile and setlineitems (1998)
emailer truncates last letter! (1997)
Problems with ^ could be solved with [REPLACE CHARACTERS] (1997)
[OT] Trying to steal databases on our server (2003)
ConvertChars (2000)
Where is f2? (1997)
sorting and grouping (1998)
dates and hex formatting (1997)
total number of matches (1999)
converting characters in form (1997)
Emailer Timing out (1999)
[WebDNA] [BULK] Webdna 6.2 and Windows Server 2012 r2 (2020)
shipcost (1997)
PCS Frames (1997)
Problems with AOHell (1999)
Re:Why did PCS send me this? (1999)