Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Time » CurrentDateTime

CurrentDateTime


Returns a string containing the date time information in selected format and all of the date time data separately.

Name Type Description
inFormat String Date time string format
outDateTimeString String Date time string
outDateTime DateTime

Description

inFormat string containing any combination of regular characters and special format specifiers. These format specifiers are replaced by the function to the corresponding values to represent the time. They all begin with a percentage (%) sign, and are:

specifier Replaced by Example
%aAbbreviated day of the week name *Thu
%AFull day of the week name * Thursday
%bAbbreviated month name *Aug
%BFull month name *August
%cDate and time representation *Thu Aug 23 14:55:02 2001
%dDay of the month (01-31)23
%HHour in 24h format (00-23)14
%IHour in 12h format (01-12)02
%jDay of the year (001-366)235
%mMonth as a decimal number (01-12)08
%MMinute (00-59)55
%pAM or PM designationPM
%SSecond (00-61)02
%UWeek number with the first Sunday as the first day of week one (00-53)33
%wDay of the week as a decimal number with Sunday as 0 (0-6)4
%WWeek number with the first Monday as the first day of week one (00-53)34
%xDate representation *08/23/01
%XTime representation *14:55:02
%yYear, last two digits (00-99)01
%YYear2001
%ZTimezone name or abbreviationCDT
%zTimezone offset in ±HHMM format+0200
%%A % sign%

* The specifiers whose description is marked with an asterisk (*) are locale-dependent.

The other parameters are calendar date and time broken down into its components as integers.

Name Meaning Range
outMillisecondsMilliseconds[0-999]
outSecondsSeconds[0-60] *
outMinutesMinutes[0-59]
outHourHour in 24h format[0-23]
outDayOfMonthDay of the month[1-31]
outMonthMonth as a decimal number[1-12]
outYearYear
outDayOfWeekDay of the week as a decimal number with Sunday as 0[0-6]
outDayOfYearDay of the year[1-366]

* Number of seconds is usually in range [0-59], value 60 is only present because of leap seconds.

Examples

Description of usage of this filter can be found in examples and tutorial: HMI Grab Single Image, HMI Recorder, OCR text validation, Basic filter usage..

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Incorrect date time format
Provided incorrect date time format. Please refer to the official documentation for more information.

Complexity Level

This filter is available on Basic Complexity Level.