formatDateby Group Public on Monday June 22 2009 @ 10:33:42 (1/1 Points) |
|
| API ↪Reference ✑ Reply ✓ Stick It ✗ Ditch It ⚐ Tag It |
formatDate produces textual representations of DateTime variables, either for printing, or for passing to the system you are testing.
Simple Mode
In simple mode the current locale of the system will be used for deciding the exact format. It can be used simply by specifying what part of the DateTime you'd like to output and then indicating the verbosity.
set %Time% as formatDate with %Date% %Var:DateTime% %Major% TIME %Format% FULL end Notice %Time%
This code produces a full representation of the current time.
Major
Major may be one of DATE, TIME, or DATETIME depending on what you'd like to output.
Format
Format in simple one may be one of SHORT, MEDIUM, LONG, or FULL.
Specific Format
As the simple format uses a locally specified date format, it may not be suitable when entering a date in a form in the application you are testing. In this case you can specify an exact form.
set %Time% as formatDate with %Date% %Now% %Format% yyyy-MM-dd HH:mm:ss.SSS end Notice %Time%
The format specifier is the one from the Java SimpleDateFormat↗ class.
Additional Options
Timezone
Indicates in which timezone the Date is to be interpreted. If not specified then the host default timezone will be used.
There is unfortunately no standard for timezone specifications, but the most common formats like Europe/Berlin will work.
Locale
Allows an alternate locale to be specified for date formatting. Locale's a specified with a language and optional country, such as de and it_FR.
This will alter the language of any output string, and will alter the format as a whole when simple date formatting is used.
If not specified then the system default will be used.
TestPlan formatDate
