TODAY operator reads the system clock and returns a DATE value that represents the current date.
TODAY used in situations when you don't need the time of day (otherwise, it is better to use CURRENT or TIME ()).
This example program gives you a simple example of how the TODAY operator can be used:
MAIN
DEFINE my_date DATE
LET my_date = TODAY
DISPLAY "Today is ", my_date
DISPLAY "Day: ", trim(DAY(my_date))
DISPLAY "Month: ", trim(MONTH(my_date))
DISPLAY "Year: ", trim(YEAR(my_date))
END MAIN
Like values returned by the CURRENT, DATE(), DAY(), MONTH(), TIME, WEEKDAY(), and YEAR(), the value returned by TODAY is sensitive to the time when your application was run and to the accuracy of your system clock.
TODAY is useful in setting default values in form fields.
This piece of code shows how to initialize a field with the current date if the field is empty. The field must be initialized before the user enters data into the field:
LET invoice_rec.inv_date = TODAY
INPUT invoice_rec WITHOUT DEFAULTS FROM sc_inv.*
Values returned by TODAY depend on the locale of your operating system.
With Lycia, you can specify the necessary date format by the DBDATE environment variable.