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()

SetDate()

SetDate()

Sets the system date

Syntax

      SetDate( <dDate>, [<lMode>] ) --> lSet

Arguments

<dDate> Designates which date to use to set the system date.

<lMode> Designates whether the date should also be set in the CMOS- RAM of an AT. The default is do not write (.F.). Note that in Windows plataform this adjust is automatic, therefore this parameter is without efect.

Returns

SetDate() RETURNs .T. when the date is successfully set.

Description

When you use this FUNCTION to set the system date from within your xHarbour application, all files acquire this date with each write procedure.

Examples

      Set the system date in each case; but the hardware clock only
      on an AT:

      dNewDate := SToD( "19910730" )
      IF ISAT()
         SetDate( dNewDate, .T. )
      ELSE
         SetDate( dNewDate )
      ENDIF

      Or, more compactly:

      SetDate( dNewDate, ISAT() )

Compliance

This function is CA-Cl*pper Tools compatible.

Platforms

Windows, Linux

Files

Source is dattime3.c, library is libct.

Seealso

SETTIME()

Harbour All Functions – S

SaveToken

SayScreen

Seconds
Secs

Select

Set

SetAtLike

SetDate

SetKey

SetMode

SetPrec

SetTime

SetTypeahead

Sign

Sin

SinH

Space

Sqrt

Str

StrDiff

StrFormat

StrSwap
StrTran
StrZero
SubStr

CT_SetTime

  NAME
     SetTime()
  CATEGORY
     HBCT Date and Time Functions
  ONELINER
     Sets the system clock
  SYNTAX
     SetTime( <cTime>, [<lMode>] ) --> lSet
  ARGUMENTS
     <cTime>  Designates a character string that contains the time that
     is to become the system time.
     <lMode>  Designates whether the time should also be set in the
     CMOS-RAM of an AT.  The default is do not write to CMOS-RAM. Note that in
     Windows platform this adjust is automatic, therefore this parameter is
     without efect.
  RETURNS
     The FUNCTION RETURNs .T. when the time is set successfully.
  DESCRIPTION
     When you use this FUNCTION to convert the time into the system time from
     within your application, all files acquire this time with
     each write procedure.
  EXAMPLES
     // Set the system time in each case; but the hardware clock only
     // on an AT:
     cNewTime := "10:20:00"
     IF IsAt()
        SetTime( cNewTime, .T. )
     ELSE
        SetTime( cNewTime )
     ENDIF
     Or, more compactly:
     SetTime( cNewTime, IsAt() )
  STATUS
     Ready
  COMPLIANCE
     This function is Clipper Tools compatible.
  PLATFORMS
     Windows, Linux
  FILES
     Library is hbct.
  SEEALSO
     SetDate(), TimeValid()

Tools — Date/Time Functions

Introduction Date/Time Functions
ADDMONTH()   Adds or subtracts months to/from a date
BOM()        Determines the date of the first day of a month
BOQ()        Determines the date for the beginning of a quarter
BOY()        Determines the date for the beginning of a year
CTODOW()     Converts the day of the week name into a corresponding number
CTOMONTH()   Converts the name of the month into a corresponding number
DMY()        Returns a date in "DD Month YY" format
DOY()        Determines the day of the year for a specific date
EOM()        Determines the date for the last day of a month
EOQ()        Determines the date for the end of a quarter
EOY()        Determines the date for the end of the year
ISLEAP()     Tests if a specific year is a leap year
LASTDAYOM()  Determines the number of days in a month
MDY()        Returns a date in the "Month DD, YY" format
NTOCDOW()    Changes the number of a weekday into a weekday name
NTOCMONTH()  Changes the number of a month into a month name
QUARTER()    Determines the quarter in which a specific date lies
SECTOTIME()  Converts seconds into a time string
SETDATE()    Sets the system date
SETTIME()    Sets the system clock
SHOWTIME()   Continuously displays the time at desired screen position
STOD()       Converts an ANSI date string into Clipper format
TIMETOSEC()  Calculates the seconds since midnight
TIMEVALID()  Determines whether a specified time is valid
WAITPERIOD() Pauses a specified time in increments of 1/100 seconds
WEEK()       Returns the calendar week for a date
WOM()        Returns the week within a month.