Date

When used with 1 or no arguments...

Result = Date ( [ Expression ] )

Return the date part of a date & time expression. If the expression is omitted, then the today date is returned.

The current localization is used, i.e. the date part in the current timezone is returned.

In other words, that function moves the date in the past at 0:00, in the current local time.

Example

Print Now; " -> "; Date(Now)
05/16/2002 15:10:59 -> 05/16/2002 00:00:00

Warning:

As can be seen in the previous example using Date() directly with PRINT this way (and in other instances) does not actually omit the time part but shows it as 00:00:00.

This is because using the Date() command always returns a Date datatype. The Date datatype returned does have a time but it is nullified using Date() this way hence the 00:00:00.

Use Split to omit the time. (see the following example)

The same example that omits the time part...


Print Now ' Print non localized date.
Print Split(Date(Now), " ")[0]  ' Or Split the localized Date() result at the space.
09/02/2024 12:39:23
02/09/2024

Date (2)

Date = Date ( Year , Month , Day [ , Hours , Minutes , Seconds ] )

Make a local date from its components.

The date components are in local time.

Examples

Print Date(1972, 9, 6, 1, 5, 17)
06/09/1972 01:05:17

Print Date(1972, 9, 6, 1, 5, 17)
Print CFloat(Date(1972, 9, 6, 1, 5, 17))
06/09/1972 01:05:17
2473671,04533565

See also