[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
FT_WOY()
Find number of week within year
------------------------------------------------------------------------------
Syntax
FT_WOY( <dDate> ) -> <nResult>
Arguments
<dDate> is a date in the form "mm/dd/yy" or "mm/dd/yyyy"
Returns
Return numeric position of week within the year or NIL if
parameter does not conform.
Description
Considers a full week as starting on Sunday, ending on Saturday.
First week of year (week 1) may start on any day, and thus
contain any number of days.
Final week of year (week 53) may contain any number of days.
Handles dates with CENTURY ON|OFF, to allow for 21st century.
Date validation must be external to this function.
Examples
These code fragments find the week number, given a date.
// literal character date
dDate := CTOD("01/01/91")
nWkNum := FT_WOY(dDate) // result: 1
// presume DOS date to be 01/06/91
nWkNum := FT_WOY(DATE()) // result: 2
// date input
cDate := SPACE(8)
@ 4,10 get cDate PICT "##/##/##" // input 07/04/91
READ
nWkNum := FT_WOY(CTOD(cDate)) // result: 27
// last day of year
nWkNum := FT_WOY(CTOD("12/31/91")) // result: 53
For a demonstration of this function, compile and link the
program WOY.PRG in the Nanforum Toolkit source code.
Source: WOY.PRG
Author: Forest Belt, Computer Diagnostic Services, Inc.
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson