Returns a value representing the current date and time.

Syntax

DATETIME( )

Description

Use DATETIME( ) to determine the lapsed time between two or more events. The actual value of DATETIME( ) appears internally in scientific notation as fractions of days, and provides little in the way of visually relevant information. Subtracting the current DATETIME( ) from another a short while later could produce something resembling -.92245370370436E-4.

To use DATETIME( ) values in a more practical format, convert the value to a character string and extract the date and/or time elements. DATETIME( ) values can be converted to character strings using the DTTOC( ) function (DateTime to Character), and back to values using the CTODT( ) function (Character to DateTime).

Once the date and time character strings have been extracted, you can convert the resulting strings to values using the CTOD( ) or CTOT( ) functions, and back again using DTOC ( ) or TTOC( ) respectively.

If you are utilizing a timestamp field you could store the current date and time to a field defined as a timestamp type:

queryName.rowset.fields["timestampfield"].value = DATETIME( )