Returns string for a given date or the system date.
Date$[(date)]
date: Date expression
Date$ returns the system date in the following format:
DD.MM.YYYY (Day.Month.Year)
MM/DD/YYYY (Month.Day.Year; US format)
YYYY-MM-DD (Year-Month-Day, international format)
The format is set with the Mode command and is NOT locale dependent (see Remarks below)..
OpenW # 1
Print Date$
// Change to US Date mode
// Mode Format does not work with Date$
Mode Date "/"
Print Date$( Date - 30 )
// For UK Date style use...
Print Format(Date, "dd/mm/yyyy")
There is no command to set the system time, because setting the time requires the SE_SYSTEMTIME_NAME privilege.
Time$() returns the time part of a date. DateTime$() returns both the date and the time.
Date$ is not locale dependent and it's return value is solely determined by either the Mode Date or the Mode Format commands. This is useful but causes problems in some locales - especially the UK, where date format is DD/MM/YYYY. In situations like this, use the Format command instead - for the UK, you would use Format(date, "dd/mm/yyyy"). Another method is to use GFABASIC's function which automatically converts a date value to a string through CDate which uses locale settings to format output - for the UK, a$ = CDate("25/11/2000") where date is 25th November 2000, a$ will be populated with "25/11/2000".
Format, Time$, DateTime$, Date, Time, Now, Mode
{Created by Sjouke Hamstra; Last updated: 16/08/2020 by James Gaite}