ex.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
DATESERIAL Function 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 the
' YEAR and WEEKDAY functions.
 
' To try this example:
' 1. Choose New Project from the File menu
' 2. Copy the code example below to the code window
' 3. Press F5 to run the example
 
 OPTION BASE 1
 DEFINT A-Z
 DIM DayOfWeek(7) AS STRING
 
 CLS                                     ' Clear the screen
 FOR I = 1 TO 7                          ' Initialize the array
     READ DayOfWeek$(I)
 NEXT I
 INPUT "What are the last two digits of your birth year"; Birthyear
 Jan1Date = DATESERIAL(Birthyear, 1, 1)  ' Calculate January 1st of birthyear
 PRINT "January 1,"; YEAR(Jan1Date); "fell on a ";  ' Display results
 PRINT DayOfWeek$(WEEKDAY(Jan1Date))
 
 DATA "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday"
 DATA "Friday", "Saturday", "Sunday"