2019-04-15 01:15:33 +00:00
|
|
|
The [[DATE$]] function returns the current computer date as a string in the format "mm-dd-yyyy".
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
2017-10-10 14:55:21 +00:00
|
|
|
{{PageSyntax}}
|
|
|
|
: {{Parameter|today$}} = [[DATE$]]
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
2017-10-10 14:55:21 +00:00
|
|
|
{{PageDescription}}
|
2019-04-15 01:15:33 +00:00
|
|
|
* Returns the current computer date in the format "mm-dd-yyyy" (e.g., "12-25-2009").
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
2017-10-10 14:55:21 +00:00
|
|
|
{{PageExamples}}
|
2015-08-02 12:12:44 +00:00
|
|
|
''Example:'' Displaying the weekday and current date.
|
|
|
|
{{CodeStart}} '' ''
|
|
|
|
{{Cl|PRINT}} {{Cl|DATE$}}
|
|
|
|
month$ = {{Cl|LEFT$}}({{Cl|DATE$}}, 2): M = {{Cl|VAL}}(month$)
|
|
|
|
day$ = {{Cl|MID$}}({{Cl|DATE$}}, 4, 2): D = {{Cl|VAL}}(day$)
|
|
|
|
day$ = {{Cl|STR$}}(D) ' eliminate any leading zeros
|
|
|
|
year$ = {{Cl|RIGHT$}}({{Cl|DATE$}}, 4): Y = {{Cl|VAL}}(year$)
|
|
|
|
{{Cl|SELECT CASE}} M
|
2019-04-15 01:15:33 +00:00
|
|
|
{{Cl|CASE}} 1: Moon$ = "January"
|
|
|
|
{{Cl|CASE}} 2: Moon$ = "February"
|
|
|
|
{{Cl|CASE}} 3: Moon$ = "March"
|
|
|
|
{{Cl|CASE}} 4: Moon$ = "April"
|
|
|
|
{{Cl|CASE}} 5: Moon$ = "May"
|
|
|
|
{{Cl|CASE}} 6: Moon$ = "June"
|
|
|
|
{{Cl|CASE}} 7: Moon$ = "July"
|
|
|
|
{{Cl|CASE}} 8: Moon$ = "August"
|
|
|
|
{{Cl|CASE}} 9: Moon$ = "September"
|
|
|
|
{{Cl|CASE}} 10: Moon$ = "October"
|
|
|
|
{{Cl|CASE}} 11: Moon$ = "November"
|
|
|
|
{{Cl|CASE}} 12: Moon$ = "December"
|
2015-08-02 12:12:44 +00:00
|
|
|
{{Cl|END SELECT}}
|
2019-04-15 01:15:33 +00:00
|
|
|
{{Cl|PRINT}} "Today is " + WeekDay$(M, D, Y) + ", " + Moon$ + day$ + ", " + year$ + {{Cl|SPACE$}}(10)
|
2017-10-10 14:55:21 +00:00
|
|
|
|
|
|
|
{{Cl|DEFINT}} A-Z
|
|
|
|
{{Cl|FUNCTION}} WeekDay$ (M, D, Y)
|
2015-08-02 12:12:44 +00:00
|
|
|
{{Cl|IF}} M < 3 {{Cl|THEN}} M = M + 12: Y = Y - 1 'add 12 to Jan - Feb month, -1 year
|
|
|
|
C = Y \ 100: Y = Y {{Cl|MOD}} 100 'split century and year number
|
|
|
|
S1 = (C \ 4) - (2 * C) - 1 'century leap
|
|
|
|
S2 = (5 * Y) \ 4 '4 year leap
|
|
|
|
S3 = 26 * (M + 1) \ 10 'days in months
|
|
|
|
WkDay = (S1 + S2 + S3 + D) {{Cl|MOD}} 7 'weekday total remainder
|
|
|
|
{{Cl|IF}} WkDay < 0 {{Cl|THEN}} WkDay = WkDay + 7 'Adjust negative results to 0 to 6
|
|
|
|
{{Cl|SELECT CASE}} WkDay
|
2019-04-15 01:15:33 +00:00
|
|
|
{{Cl|CASE}} 0: day$ = "Sunday"
|
|
|
|
{{Cl|CASE}} 1: day$ = "Monday"
|
|
|
|
{{Cl|CASE}} 2: day$ = "Tuesday"
|
|
|
|
{{Cl|CASE}} 3: day$ = "Wednesday"
|
|
|
|
{{Cl|CASE}} 4: day$ = "Thursday"
|
|
|
|
{{Cl|CASE}} 5: day$ = "Friday"
|
|
|
|
{{Cl|CASE}} 6: day$ = "Saturday"
|
2015-08-02 12:12:44 +00:00
|
|
|
{{Cl|END SELECT}}
|
|
|
|
WeekDay$ = day$
|
|
|
|
{{Cl|END FUNCTION}} '' ''
|
|
|
|
{{CodeEnd}}
|
|
|
|
{{small|Code by Ted Weissgerber}}
|
|
|
|
{{OutputStart}}
|
|
|
|
06-02-2010
|
|
|
|
Today is Wednesday, June 2, 2010
|
|
|
|
{{OutputEnd}}
|
|
|
|
|
|
|
|
|
2017-10-10 14:55:21 +00:00
|
|
|
{{PageSeeAlso}}
|
2021-01-24 03:36:34 +00:00
|
|
|
* [[TIME$]]
|
2015-08-02 12:12:44 +00:00
|
|
|
* [[VAL]], [[STR$]], [[MID$]], [[LEFT$]], [[IF...THEN]]
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-15 01:15:33 +00:00
|
|
|
{{PageNavigation}}
|