2017 October Release

Date and Time ValuesPermanent link for this heading

By default app.test uses following format:

  • dd.MM.yyyy (date)
  • HH:mm:ss (time)

Date and time values can be formatted with following functions:

  • DateFormat
  • TimeFormat

As locale the Java locale of the app.test player is used by default. But the locale can also be defined within the test.

Example

<Set parameter='Java.Locale' value='en'/>
<Set parameter='Java.Locale' value='de'/>
<!-- deletes the parameter -->
<Set parameter='Java.Locale' value='NULL'/>

For parsing and formatting date values DateFormat.SHORT is used, for time values DateFormat.MEDIUM.

See http://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html.

Example

<!-- formats the current date or time based on the locale -->
<Set parameter='d' eval='DateFormat()'/>
<Set parameter='t' eval='TimeFormat()'/>

<!-- parses and formats the string based on the locale -->
<Set parameter='d' eval='DateFormat("<date>")'/>
<Set parameter='t' eval='TimeFormat("<time>")'/>

<!-- formats the date or time (default app.test format) based on the locale -->
<Set parameter='d' eval='DateFormat(<date>)'/>
<Set parameter='t' eval='TimeFormat(<time>)'/>

<!-- parses the string based on the locale and formats based on the pattern -->
<Set parameter='d' eval='DateFormat("<date>", "<pattern>")'/>
<Set parameter='t' eval='TimeFormat("<time>","<pattern>")'/>

<!-- formats the date or time (default app.test format) based on the pattern -->
<Set parameter='d' eval='DateFormat(<date>, "<pattern>")'/>
<Set parameter='t' eval='TimeFormat(<time>,"<pattern>")'/>

<!-- parses and formats the location value based on the locale -->
<Set parameter='d' location='<location>' eval='DateFormat()'/>
<Set parameter='t' location='<location>' eval='TimeFormat()'/>

<!-- parses the location value based on the locale and formats based on the pattern -->
<Set parameter='d' location='<location>' eval='DateFormat("<pattern>")' />
<Set parameter='t' location='<location>' eval='TimeFormat("<pattern>")' />

<!-- calculations -->
<Set parameter='d' eval='DateFormat({~datenow~} + 365)'/>
<Set parameter='t' eval='TimeFormat({~timenow~} - 60)'/>