Returns the week within a month.
WOM([<dDate>]) --> nWeekOfMonth
<dDate> Designates a date for which you want to determine which
week of the month it lies in. The default is the system date.
WOM() returns the number that reflects the week within a month in which
The WOM() function can returns the corresponding week of the month for
every valid date.
. When no date is specified, WOM() uses the system date. An
empty date returns a result of 0.
Compute a delivery date:
? "We will deliver in week" + STR(WOM(dDate)) + " in; August!"
Returns the calendar week for a date
WEEK([<dDate>]) --> nWeekOfYear
<dDate> Designates a date for which the week it lies in, is
determined. The default is the system date.
WEEK() returns a sequential week number that designates in which week of
the year <dDate> lies.
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.
. When no date is specified, then WEEK() uses the system date.
An empty date leads to a 0 result.
Determine the week for a date:
dDate := CTOD("03/14/92")
? "This date is in week: ", WEEK(dDate)
Converts an ANSI date string into Clipper format
STOD(<cAnsiDate>) --> dDate
<cAnsiDate> Designates the character string that contains a date in
the ANSI format "YYYYMMDD" that is to be converted into the Clipper
STOD() returns the <cAnsiDate> character string in the corresponding
Clipper date format.
STOD() converts an ANSI date created by the Clipper DTOS() function,
back into the standard date format.
. If the ANSI date is invalid, a null date is returned.
Display the ANSI date in default date format:
APPEND FROM OTHDATE
Continuously displays the time at desired screen position
ShowTime([<nRow>], [<nColumn>], [<lMode>],
[<cAttr|nAttr>], [<l12/24>], [<lAM/PM>]) --> cNull
<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
() A call without parameters uninstalls the time display.
ShowTime() always returns a null string.
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.
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).
. 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
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")
Calculates the seconds since midnight
TimeToSec(<cTime>) --> nSeconds
<cTime> Designates a character string that contains the time in the
format "HH:MM:SS:hh". The default is the system time.
The returned value designates how many seconds have elapsed between
midnight and <cTime>. Hundredths of seconds are contained as a decimal
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.
. 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:
See Also: SECTOTIME()
Converts seconds into a time string
SecToTime(<nSeconds>, [<lHundredth>]) --> cTime
<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
SecToTime() returns a time string that corresponds to <nSeconds> in the
"HH:MM:SS" or "HH:MM:SS:hh" format.
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
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.
. Seconds since midnight are in the range of 0 to 86400. With
larger values, the function internally executes the operation
% 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
. 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()
Determines the quarter in which a specific date lies
Quarter([<dDate>]) --> nQuarter
<dDate> Designates in which quarter the specified date lies. The
default is the system date.
Quarter() returns a number that identifies the quarter in which <dDate>
Quarter() determines which quarter of the year <dDate> lies.
. When no date is specified, the function automatically uses the
system date. An empty date returns 0 as a result.
Compute a delivery date:
? "We will deliver in quarter ", Quarter(CTOD("07/12/1991")), "1991"
Changes the number of a month into a month name
NToCMonth(<nMonth>) --> cMonth
<nMonth> Designates a month number for which a month name is returned.
NToCMonth() returns the name that corresponds to the month number.
NToCMonth() determines the month name that corresponds to its month
number. January is 1, February is 2, ..., December is 12. If a number
outside this range is passed, the function returns a null string as a
The function's operation depends on the country specific adaptation of
your Clipper compiler. With an English version of Clipper, only
English day names are returned.
An English Clipper returns:
? NToCMonth(1) //"January"
? NToCMonth(2) //"February"
? NToCMonth(12) //"December"
? NToCMonth(14) //""
See Also: CToMonth()
Changes the number of a weekday into a weekday name
NTOCDOW(<nWeekday>) --> cWeekday
<nWeekday> Designates a weekday number from 1 to 7.
NTOCDOW() returns a name that corresponds to its weekday number.
This function converts a weekday number into the corresponding name.
Sunday is 1, Monday is 2, Saturday is 7. If you pass a number outside
of this range, the function returns a 0 value.
. Function operation depends on the country-specific adaptation
of your Clipper compiler. With an English version of Clipper,
only English day names are returned.
An English Clipper returns:
? NTOCDOW(1) // "Sunday"
? NTOCDOW(4) // "Wednesday"
? NTOCDOW(7) // "Saturday"
? NTOCDOW(8) // ""
See Also: CTODOW()