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=20 project. It also checks for past dates. WebDNA=20 formats for correct dates when going from math to=20 a formatted style. When going the other way, from=20 an impossible date, WebCat calculates the right=20 number regardless (i.e., June 31 would render as=20 if 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=20 problem. I show the form again pre-filled-out,=20 with an error message. [/showif] Terry Justin Carroll wrote: I'm receiving a date from user input (i.e. 02/30/2004) and would like to =3D validate it with webDNA. I'd like to check it against, one, if it even =3D exists and two, if it even exists due to leap year. Does anyone have a =3D pre-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:

    
  1. Re: Validating A Date ( Justin Carroll 2004)
  2. Re: Validating A Date ( Donovan Brooke 2004)
  3. Re: Validating A Date ( Terry Wilson 2004)
  4. Validating A Date ( Justin Carroll 2004)
  5. Re: Validating a date (WebDNA Support 2000)
I recently wrote exactly this, on a current=20 project. It also checks for past dates. WebDNA=20 formats for correct dates when going from math to=20 a formatted style. When going the other way, from=20 an impossible date, WebCat calculates the right=20 number regardless (i.e., June 31 would render as=20 if 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=20 problem. I show the form again pre-filled-out,=20 with an error message. [/showif] Terry Justin Carroll wrote: I'm receiving a date from user input (i.e. 02/30/2004) and would like to =3D validate it with webDNA. I'd like to check it against, one, if it even =3D exists and two, if it even exists due to leap year. Does anyone have a =3D pre-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)