Viva Clipper !

CT_TimeValid

Advertisements
  NAME
     TimeValid()
  CATEGORY
     HBCT Date and Time Functions
  ONELINER
     Determines whether a specIFied time is valid
  SYNTAX
     TimeValid( <cTime> ) --> lValid
  ARGUMENTS
     <cTime>  Designates a character string that contains the time to
     test.
  RETURNS
     TimeValid() RETURNs .T. when <cTime> is a valid time; or .F. when
     <cTime> is an invalid time.
  DESCRIPTION
     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
     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).
  EXAMPLES
       PROC MAIN()
          SETMODE( 25, 80 )
          CLS
          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 )
          READ
       RETURN // MAIN
  STATUS
     Ready
  COMPLIANCE
     This function is Clipper Tools compatible.
  PLATFORMS
     All
  FILES
     Library is hbct.
  SEEALSO
     SetTime()

		
Advertisements

Advertisements