[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+-----------+##############################################################
#+-| DAYS_FROM |----------------------------------------------------+#########
#| +-----------+ Returns a date that is number_days from date_value |#########
#+------------------------------------------------------------------+#########
##############################################################################
##############################################################################
#+--| Summary |--------------+################################################
#| #INCLUDE date.hdr |################################################
#+---------------------------+################################################
##############################################################################
##############################################################################
#+--| Syntax |-------------------------------------------------------+########
#| FUNCTION DATE days_from PROTOTYPE |########
#| PARAMETERS VALUE DATE date_value, VALUE LONG number_days |########
#+-------------------------------------------------------------------+########
##############################################################################
##############################################################################
#################+---| Description |-----------------------+##################
#################| The days_from() function returns a date |##################
#################| that is number_days from date_value. |##################
#################+-----------------------------------------+##################
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Print the maturity date of 90-day T-bills. |#########
#########| |#########
#########| ? "Bonds issued on ", today(), "mature on ", ; |#########
#########| days_from( today(), 90 ) |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * file: \force\source\weekday.prg |#########
#########| * (** source code included with compiler **) |#########
#########| * This example encodes a function that returns |#########
#########| * the date of a "recall" (i.e., a check-up) |#########
#########| * ensuring the date falls on a weekday. |#########
#########| |#########
#########| #include date.hdr |#########
#########| FUNCTION DATE weekday |#########
#########| PARAMETERS VALUE DATE start_date, VALUE INT days |#########
#########| VARDEF |#########
#########| DATE d |#########
#########| INT bias |#########
#########| ENDDEF |#########
#########| |#########
#########| bias = 0 |#########
#########| d = days_from( today(), days ) |#########
#########| IF dow( d ) = 1 && Sunday? |#########
#########| bias = 1 && goes to Monday |#########
#########| ENDIF |#########
#########| IF dow( d ) = 7 && Saturday? |#########
#########| bias = 2 && goes to Monday |#########
#########| ENDIF |#########
#########| |#########
#########| RETURN days_from( d, bias ) |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
cdow()
cmonth()
ctod()
day()
days_btw_dates()
dow()
dtoc()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson