Skip to content

CurrentDateTime

See Also: Time and Date Functions

Purpose

The CurrentDateTime function returns a DateTime or Time variable that contains the current local time.

Return Type

Syntax

CurrentDateTime()

What It Does

The CurrentDateTime function returns a DateTime variable or Time variable that contains the current local time. This function respects the current Windows regional settings configuration for the date and time format.

Examples

Example 1: Current Date and Time to DateTime Variable

This sample moves the current date and time to a DateTime variable.

Procedure TestCurrentDateTime
    DateTime dtCurrentDateTime
    Move (CurrentDateTime()) to dtCurrentDateTime
    Showln "The time is " dtCurrentDateTime
End_Procedure

Example 2: Current Time to Time Variable

This sample moves the current time to a Time variable.

Time tiNow
Move (CurrentDateTime()) to tiNow

Example 3: Current Date to Date Variable

This sample moves the current date to a Date variable.

Date dNow
Move (CurrentDateTime()) to dNow