82 lines
2.4 KiB
Plaintext
82 lines
2.4 KiB
Plaintext
|
|
/* $DOC$
|
|
$NAME$
|
|
ft_WoY()
|
|
$CATEGORY$
|
|
Date/Time
|
|
$ONELINER$
|
|
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 := hb_SToD( "19910101" )
|
|
nWkNum := ft_WoY( dDate ) // result: 1
|
|
|
|
// presume DOS date to be 1991-01-06
|
|
nWkNum := ft_WoY( Date() ) // result: 2
|
|
|
|
// date input
|
|
dDate := hb_SToD()
|
|
@ 4, 10 GET cDate // input 1991-07-04
|
|
READ
|
|
nWkNum := ft_WoY( dDate ) // result: 27
|
|
|
|
// last day of year
|
|
nWkNum := ft_WoY( hb_SToD( "19911231" ) ) // result: 53
|
|
$END$
|
|
*/
|
|
|
|
/* $DOC$
|
|
$NAME$
|
|
ft_DoY()
|
|
$CATEGORY$
|
|
Date/Time
|
|
$ONELINER$
|
|
Find number of day within year
|
|
$SYNTAX$
|
|
ft_DoY( <dDate> ) -> <nResult>
|
|
$ARGUMENTS$
|
|
<dDate> is a date in the form "mm/dd/yy" or "mm/dd/yyyy"
|
|
$RETURNS$
|
|
Return numeric position of day within the year.
|
|
Return NIL if parameter does not conform.
|
|
$DESCRIPTION$
|
|
Finds the day number, considering 01/01 as day 1
|
|
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 day number, given a date.
|
|
|
|
// literal character date
|
|
dDate := hb_SToD( "19910101" )
|
|
nDayNum := ft_DoY( dDate ) // result: 1
|
|
|
|
// presume DOS date to be 1991-01-06
|
|
nDayNum := ft_DoY( Date() ) // result: 6
|
|
|
|
// date input
|
|
dDate := hb_SToD()
|
|
@ 4, 10 GET cDate // input 1991-07-04
|
|
READ
|
|
nDayNum := ft_DoY( dDate ) // result: 185
|
|
|
|
// last day of year
|
|
nDayNum := ft_DoY( hb_SToD( "19911231" ) ) // result: 365
|
|
$END$
|
|
*/
|