bas7ex.hlp (Topic list)
$INCLUDE and DateSerial# Programming Example
                       Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
'This example uses the DateSerial# function to calculate the date value for
'January 1st in the year of your birth. You are then told what day of the
'week January 1st fell on in that year. Information is displayed using Year&
'and Weekday& functions.
 
'Note: To run this example you must use a Quick library that includes the
'procedures contained in the date/time library files. The following
'include file must also be present.
 
'$INCLUDE: 'DATIM.BI'
 
OPTION BASE 1
DEFINT A-Z
DIM DayOfWeek(7) AS STRING
 
'Initialize the array.
FOR I = 1 TO 7
    READ DayOfWeek$(I)
NEXT I
 
INPUT "What are the last two digits of your birth year"; Birthyear
 
'Calculate January 1st of birthyear.
Jan1Date# = DateSerial#(Birthyear, 1, 1)
 
'Display results.
PRINT "January 1,"; Year&(Jan1Date#); "fell on a ";
PRINT DayOfWeek$(Weekday&(Jan1Date#))
 
DATA "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday"
DATA "Friday", "Saturday", "Sunday"