CT_WOM

 

 WOM()
 Returns the week within a month.

 Syntax

     WOM([<dDate>]) --> nWeekOfMonth

 Argument

     <dDate>  Designates a date for which you want to determine which
     week of the month it lies in.  The default is the system date.

 Returns

     WOM() returns the number that reflects the week within a month in which
     <dDate>lies.

 Description

     The WOM() function can returns the corresponding week of the month for
     every valid date.

 Note

     .  When no date is specified, WOM() uses the system date.  An
        empty date returns a result of 0.

 Example

     Compute a delivery date:

     ? "We will deliver in week" + STR(WOM(dDate)) + " in; August!"


CT_WEEK

 WEEK()
 Returns the calendar week for a date

 Syntax

     WEEK([<dDate>]) --> nWeekOfYear

 Argument

     <dDate>  Designates a date for which the week it lies in, is
     determined.  The default is the system date.

 Returns

     WEEK() returns a sequential week number that designates in which week of
     the year <dDate> lies.

 Description

     The week of the year in which a day lies is information required by a
     number of technical financial calculations or wage accounting.  This
     function determines this week and acknowledged all calendar rules.

 Note

     .  When no date is specified, then WEEK() uses the system date.
        An empty date leads to a 0 result.

 Example

     Determine the week for a date:

     dDate  :=  CTOD("03/14/92")

     ? "This date is in week:  ", WEEK(dDate)

 

CT_SToD

 


 STOD()
 Converts an ANSI date string into Clipper format

 Syntax

     STOD(<cAnsiDate>) --> dDate

 Argument

     <cAnsiDate>  Designates the character string that contains a date in
     the ANSI format "YYYYMMDD" that is to be converted into the Clipper
     date format.

 Returns

     STOD() returns the <cAnsiDate> character string in the corresponding 
     Clipper date format.

 Description

     STOD() converts an ANSI date created by the Clipper DTOS() function,
     back into the standard date format.

 Note

     .  If the ANSI date is invalid, a null date is returned.

 Example

     Display the ANSI date in default date format:

     APPEND FROM OTHDATE
     LIST STOD(cAnsiDate)

 

CT_ShowTime

ShowTime()
 Continuously displays the time at desired screen position

 Syntax

     ShowTime([<nRow>], [<nColumn>], [<lMode>],
        [<cAttr|nAttr>], [<l12/24>], [<lAM/PM>]) --> cNull

 Arguments

     <nRow>  Designates the row where the time is displayed.  The default
     is the cursor row.

     <nColumn>  Designates the column where the time is displayed.  The
     default is the cursor column.

     <lMode>  Designates whether seconds are to appear in the time
     display (.F.), or not (.T.).  The default is display seconds (.F.).

     <cAttr|nAttr>  Designates to the screen attribute to use for the
     time display.  Strings in the form "NN/NN" or "CC/CC" (e.g., "0/7" or
     "B/GR") are possible.  The default is the setting for CLEARA (see
     Introduction, Video Functions).

     <l12/24>  By designating this parameter as .T., a 12-hour display is
     selected.  The default is a 24-hour display (.F.).

     <lAM/PM>  If you have a 24-hour display, you may want to switch on
     an am/pm display.  When you specify this parameter as .T., an "a" or "p"
     (as in DOS), appears to reflect the time.  The default is no display
     (.F.).

     ()  A call without parameters uninstalls the time display.

 Returns

     ShowTime() always returns a null string.

 Description

     This function permits you to constantly display the time in any screen
     position desired. ShowTime() is interrupt controlled and has the ability
     to display the time in either "hh:mm:ss" or "hh:mm" format.  A 12- or 24     -hour display can be selected, with or without an am/pm display.

 Notes

     Warning!  ShowTime() works with the interrupt system.  Before
     leaving your Clipper application, you must uninstall ShowTime() , so
     that the interrupt vectors can be restored.  Otherwise, the system will
     be unstable and will eventually crash.  Simultaneous use of the
     accompanying Extended Drivers Modules automatically restores the
     interrupt vectors in use.

     .  Specify the screen attribute as either a numeric or a string
        in "NN/NN" form.  If no attribute is specified, the value for CLEARA
        applies (see Introduction Video Functions).

 Examples

     .  Display a clock in row 0, column 70, with no seconds display
        and the standard attribute.  When a display is shown in row 0, switch
        SCOREBOARD off!

        SET SCOREBOARD OFF
        ShowTime(0, 70, .T.)      //  Turn on clock
           *...
           *...
        SHOWTIME()                //  Uninstall clock

     .  Show a 12-hour display with am/pm on the lowest row.  White
        letters on a blue background:

        ShowTime(24, 70, .T., "W/B")

CT_TimeToSec

TimeToSec()
 Calculates the seconds since midnight
 Syntax

     TimeToSec(<cTime>) --> nSeconds

 Argument

     <cTime>  Designates a character string that contains the time in the
     format "HH:MM:SS:hh".  The default is the system time.

 Returns

     The returned value designates how many seconds have elapsed between
     midnight and <cTime>.  Hundredths of seconds are contained as a decimal
     value.

 Description

     When computing time periods, or when adding times, it is simpler to deal
     with seconds since midnight instead of time designations.  These
     calculations are simplified significantly.  The SECTOTIME() function
     converts the result into a time designation again.  Starting from back
     to front, you can omit the hundredths, seconds, and minutes from the
     time string that is passed as a parameter.  These values are then
     assumed to be "00".

     If you do not specify a parameter, the function uses the current time on
     the system clock.

 Examples

     .  A simple conversion:

        ? TimeToSec("12:44:33:22")                 // Result:  45873.22

     .  The period between two times is calculated. The result is
        displayed in seconds:

        cBegin      :=  "12:55:44:33"
        cEnd         :=  "14:56:12:22"
        ? TimeToSec(cEnd) - TIMETOSEC(cBegin)      // Period in seconds

     .  Possible formats:

        ? TimeToSec("12")
        ? TimeToSec("12:44)
        ? TimeToSec("12:44:33)
        ? TimeToSec("12:44:33:22")

See Also: SECTOTIME()

CT_SecToTime

SecToTime()
 Converts seconds into a time string

 Syntax

     SecToTime(<nSeconds>, [<lHundredth>]) --> cTime

 Arguments

     <nSeconds>  Designates the number of seconds since midnight to
     convert into a character string in time format.

     <lHundredth>  If this optional parameter is designated as .T., the
     resulting time string contains hundredths of seconds.  The default is no
     hundredths (.F.).

 Returns

     SecToTime() returns a time string that corresponds to <nSeconds> in the
     "HH:MM:SS" or "HH:MM:SS:hh" format.

 Description

     This function can be applied in two areas -- to convert numeric time
     spans in seconds, and to convert a point in time into the "HH:MM:SS" or
     "HH:MM:SS:hh" format.

     If hundredths of seconds are also desired in the time string result,
     then designate the second parameter as .T..  The portion of the value
     for <nSeconds> to the right of the decimal is also converted.

 Notes

     .  Seconds since midnight are in the range of 0 to 86400.  With
        larger values, the function internally executes the operation
        <nSeconds>
        % 86400 and then uses the result value.  86400 seconds corresponds to
        an entire day.

     .  There is no rounding when values like 45366.98 are converted
        without hundredths.

 Examples

     .  Calculate the span between two times.  The result is displayed
        in the "HH:MM:SS" format:

        nBeginning  :=  170
        nEnd         :=  3656
        ? SECTOTIME(nEnd - nBeginning)     // "00:58:06"

     .  With hundredth seconds:

        ? SECTOTIME(45873.22, .T.)         // "12:44:33:22"

See Also: TIMETOSEC()

 

CT_Quarter

Quarter()
Determines the quarter in which a specific date lies

 Syntax

     Quarter([<dDate>]) --> nQuarter

 Argument

     <dDate>  Designates in which quarter the specified date lies.  The
     default is the system date.

 Returns

     Quarter() returns a number that identifies the quarter in which <dDate>
     lies.

 Description

     Quarter() determines which quarter of the year <dDate> lies.

 Note

     .  When no date is specified, the function automatically uses the
        system date.  An empty date returns 0 as a result.

 Example

     Compute a delivery date:

     ? "We will deliver in quarter ", Quarter(CTOD("07/12/1991")), "1991"