< Futurebasic < Language < Reference

DATE$ function

DATE$

Function

✔ Appearance ✔ Standard ✔ Console

Syntax

dateString$ = DATE$

Description

The DATE$ function reads the system clock and returns the current date as a string in the format: MM/DD/YY (that is, the string returned contains two digit numerals each for month, day and year, separated by slash marks).

You can use the Toolbox routine IUDATESTRING to get a date string that is formatted according to the international specifications set in the "Date & Time" control panel. See the sample program IUDATESTRING.BAS to see how this is done.

Example

res/cd.gif image CD Example: IUDATESTRING.BAS

Note

The DATE$ function only returns the last two digits of the year. To get the complete 4-digit year value, you can use the SECONDSTODATE Toolbox function (previously SECS2DATE - both are supported in FutureBasic), as follows:

DIM dateRec AS DateTimeRec
DIM secs&
DIM theMonth%,theDay%,theYear%,theWeekday%
CALL GETDATETIME( secs& )
CALL SECONDSTODATE(secs&,dateRec)
theMonth%  = dateRec.month
theDay%    = dateRec.day
theYear%   = dateRec.year       'Full 4 digits
theWeekday% = dateRec.dayOfWeek '1=Sunday, 7=Saturday
PRINT theMonth%
PRINT theDay%
PRINT theYear%
PRINT theWeekday%

See Also

TIME$; TIMER statement

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.