HBCT Date and Time Functions
     Determines whether a specIFied time is valid
     TimeValid( <cTime> ) --> lValid
     <cTime>  Designates a character string that contains the time to
     TimeValid() RETURNs .T. when <cTime> is a valid time; or .F. when
     <cTime> is an invalid time.
     With input that requires time manipulation, writing your own UDF to
     check time inputs was unavoidable up to now.  TimeValid() permits
     Complete checking of a time designation.  You can use this FUNCTION
     effectively with a VALID clause within a READ mask.
     Note the format for time designations.  There must always be
     two digits for hours, minutes, seconds, and hundredths; otherwise,
     the time it is regarded as invalid.  Valid examples are "12",
     "12:59", "12:59:59", and "12:59:59:99".  By contrast, invalid
     examples are "24", "12:60", or "12:1", and/or "12:".  IF you work
     with time strings that are not completely filled and that you need to
     check with TimeValid(), then they must be TRIMmed prior to the use of
     TimeValid() (see following Examples).
       PROC MAIN()
          SETMODE( 25, 80 )
          cBegin := TIME()
          cEnd  := SECTOTIME( SECONDS() + 60 )
          // Using the VALID clause with TRIM, all valid times are
          // accepted, even IF no seconds or minutes are specified:
          @ 5, 10 SAY "Please input time for beginning work:";
             GET cBegin VALID TimeValid( RTrim( cBegin ) )
          // Using a VALID clause without TRIM, hours and minutes must be
          // specified, so that TimeValid() can confirm a valid time:
          @ 7, 10 SAY "Please input time for beginning work:";
             GET cEnd VALID TimeValid( cEnd )
       RETURN // MAIN
     This function is Clipper Tools compatible.
     Library is hbct.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.