Hi Rick,

I appreciate you. In this code year>0 then it pass. If I enter 2008 or 08
both or equal. Right?
My doubt is  if year SHOULD BE 4 CHARACTERS  then how does it work??

clarify me.
Thats why I prefer Regular expression.
On Fri, Dec 5, 2008 at 7:54 AM, Rick Hall <[EMAIL PROTECTED]> wrote:

>
> Close, and much better than the regular expressions that allow
> February 30 and other assorted bad dates.
>
> arr = split(date, ""\")
> /* month out of range [1..12] */
> If arr(0) > 12 OR arr(0) < 1 Then
>   report error
> End If
> /* day too small */
> If arr(1) < 1 Then
>   report error
> End If
> /* there is no year 0, negative numbers are BCE */
> If arr(2) = 0 Then
>   report error
> End If
> /* 30 days hath September ...*/
> If arr(0) = 1 OR arr(0) = 3 OR arr(0) = 5 OR arr(0) = 7 OR arr(0) = 8
> OR arr(0) = 10 OR arr(0) = 12 THEN
>   If arr(1) > 31 Then
>      report error
>   End If
> End If
> If arr(0) = 4 OR arr(0) = 6 OR arr(0) = 9 OR arr(0) = 11 THEN
>   If arr(1) > 30 Then
>      report error
>   End If
> End If
> If arr(0) = 2 THEN
>   If arr(1) > 29 Then
>      report error
>   End If
>   If arr(1) = 29 Then
>      IF /* not Leap Year */ THEN
> /* left as an exercise; years, arr(2), divisible by 4 are leap years,
> unless they are divisible by 100 when they are not leap years, unless
> they are divisible by 400 when they are leap years */
>         report error
>      End If
>   End If
> End If
>
> Detailed and messy. But this is the heart of programming. Your
> database will choke on bad dates.
>
> Rick
>
> >
>


-- 
Regards..
Venkat

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to