[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+--------+#################################################################
#+-| YEAR() |-----------------------------------+#############################
#| +--------+ Converts date_value to an integer |#############################
#+----------------------------------------------+#############################
##############################################################################
##############################################################################
#+--| Summary |--------------+################################################
#| #INCLUDE date.hdr |################################################
#+---------------------------+################################################
##############################################################################
##############################################################################
#+--| Syntax |-------------------------------+################################
#| FUNCTION UINT year PROTOTYPE |################################
#| PARAMETERS VALUE DATE date_value |################################
#+-------------------------------------------+################################
##############################################################################
##############################################################################
##################+---| Description |-----------------------+#################
##################| The year() function converts date_value |#################
##################| to an integer representing the year. |#################
##################+-----------------------------------------+#################
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Print the current year. |#########
#########| |#########
#########| ? year( today() ) Prints "1991" |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Calculate the age of an employee. |#########
#########| |#########
#########| FUNCTION INT age |#########
#########| age = year(today())-year(emp->birthdate) |#########
#########| If month(today()) > month(emp->birthdate) |#########
#########| RETURN age |#########
#########| ENDIF |#########
#########| IF month(today()) < month(emp->birthdate) |#########
#########| age = age-1 |#########
#########| ELSE |#########
#########| IF day(today()) < day(emp->birthdate) |#########
#########| age = age - 1 |#########
#########| ENDIF |#########
#########| RETURN age |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
cmonth()
ctod()
day()
month()
today()
...
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson