|today()||Returns a string with today’s local date.|
|now()||Returns the current date and time including timezone offset.|
|format-date(date value, string format)||Returns the provided date value formatted as defined by the format argument using the following identifiers: |
%Y: 4-digit year,
%y: 2-digit year,
%m 0-padded month,
%n numeric month,
%b short text month (Jan, Feb, etc),
%d 0-padded day of month,
%e day of month,
%a short text day (Sun, Mon, etc).
|=format-date($mydate, "%a, %e %b %Y") returns a date that looks like Tue, 1 Jan 2019.|
|format-date-time(dateTime value, string format)||Returns the provided dateTime value formatted as defined by the format argument using the same identifiers as format-date (see above) plus the following: |
%H 0-padded hour (24-hr time),
%h hour (24-hr time),
%M 0-padded minute,
%S 0-padded second,
%3 0-padded millisecond ticks.
|=format-date-time(now(), "%H:%M:%S") returns the current time in the format HH:MM:SS|
|date(* value)||Converts to a string in the current date format.||Dates stored as text would need to be converted to date format in order to use the date functions.|
|decimal-date-time(dateTime value)||Converts dateTime value to the number of days since January 1, 1970 UTC.|
|decimal-time(time value)||Converts time value to a number representing a fractional day in the device’s timezone. For example, noon is 0.5 and 6pm is 0.75.|
The fieldworker must record the date of the interview. Validation must be added to ensure that no date in the future is accepted for this field.
- Click on the Validation tab of the field.
- Select the comparison type to be 'less than or equal to'.
- For the value to compare against, type '=' then select today().
Also see here for more functions and expressions you can use.