Volatile Functions

Now and Today are volatile functions. Each time one of these functions is evaluated it returns a different value.

When used in a data flow formula, a volatile function will only return a different value if the formula in which it appears is reevaluated. If nothing else changes in the formula then it will have the same value throughout the execution of your app.

For example, a label control with Label1.Text = Now() will not change while your app is active. Only closing and reopening the app will result in a new value.

The function will be reevaluated if it is part of a formula in which something else has changed. For example, if we change our example to involve a slider control with Label1.Text = DateAdd( Now(), Slider1.Value, Minutes ) then the current time is retrieved each time the Slider control's value changes and the label's text property is reevaluated.

When used in a behavior formula, volatile functions will be evaluated each time the behavior formula is evaluated. See below for an example.

Syntax

Now()

Today()

IsToday( DateTime )

DateTime - Required. The date/time value to test.

Examples

For the examples in this section, the current time is 3:59 AM on February 12, 2015, and the language is en-us.

Formula

Description

Result

Text( Now(), "mm/dd/yyyy hh:mm:ss" )

Retrieves the current date and time, and displays it as a string.

"02/12/2015 03:59:00"

Text( Today(), "mm/dd/yyyy hh:mm:ss" )

Retrieves the current date only, leaving the time portion as midnight, and displays it as a string.

"02/12/2015 00:00:00"

IsToday( Now() )

Tests whether the current date and time is between midnight today and midnight tomorrow.

true

IsToday( Today() )

Tests whether the current date is between midnight today and midnight tomorrow.

true

Text( DateAdd( Now(), 12 ), "mm/dd/yyyy hh:mm:ss" )

Retrieves the current date and time, adds 12 days to the result, and displays it as a string.

"02/24/2015 03:59:00"

Text( DateAdd( Today(), 12 ), "mm/dd/yyyy hh:mm:ss" )

Retrieves the current date, adds 12 days to the result, and displays it as a string.

"02/24/2015 00:00:00"

IsToday( DateAdd( Now(), 12 ) )

Tests whether the current date and time, plus 12 days, is between midnight today and midnight tomorrow.

false

IsToday( DateAdd( Today(), 12 ) )

Tests whether the current date, plus 12 days, is between midnight today and midnight tomorrow.

false

Display a clock that updates in real time

Add a Timer control, set its Duration property to 1000, and set its Repeat property to true.

The timer will run for one second, automatically start over, and continue that pattern.

Set the control's OnTimerEnd property to this formula:

Set( CurrentTime, Now() )

Whenever the timer starts over (after each second), this formula sets the CurrentTime global variable to the current value of the Now function.