TimeValid()

TimeValid()

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

      Using the VALID clause with TRIM, all valid times are
      accepted, even IF no seconds or minutes are specIFied:

      cBegin := SPACE( 11 )
      @ 5, 10 SAY "Please input time for beginning work:";
      GET cBegin VALID TimeValid( RTRIM( cBegin ) )
      READ

      Using a VALID clause without TRIM, hours and minutes must be
      specified, so that TimeValid() can confirm a valid time:

      cBegin := SPACE( 5 )
      @ 5, 10 SAY "Please input time for beginning work:";
      GET cBegin VALID TimeValid( cBegin )
      READ

Compliance

This function is CA-Cl*pper Tools compatible.

Platforms

All

Files

Source is dattime3.c, library is libct.

Seealso

SETTIME()

Advertisements

2 responses to “TimeValid()

  1. Pingback: Harbour Date & Time Functions | Viva Clipper !

  2. Pingback: Harbour All Functions – T | Viva Clipper !

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s