Today

Description

Obtains the system date and, in some cases, the system time.

Syntax

Today ( )

Returns

Date. Returns the current system date.

Usage

Although the datatype of the Today function is date, it can also return the current time. This occurs when Today is used as an argument for another function and that argument allows different datatypes.

For example, if you call Today as an argument to the String function, String returns both the date and time when you use a date-plus-time display format. A second example: if you call Today as an argument for the SetItem function and the datatype of the target column is DateTime, both the date and time are assigned to the DataWindow.

Examples

Example 1

This statement returns the current system date:

Today()

Example 2

This statement executes some statements when the current system date is before April 15, 2003:

IF Today() < 2003-04-15 THEN ...

Example 3

This statement displays the current date in the StaticText st_date in the corner of a window:

st_date.Text = String(Today(), "m/d/yy")

Example 4

This statement displays the current date and time in the StaticText st_date:

st_date.Text = String(Today(), "m/d/yy hh:mm")

See also