t.jspringbot-date.1.0.source-code.libdoc.intro Maven / Gradle / Ivy
JSpringBot Date Library for Robot Framework.
= Configuration =
Configure the following to use jspringbot-expression.
1. Add this artifact in maven dependency
|
|
| org.jspringbot
| jspringbot-date
|
|
2. Import spring-expression in {{jspringbot-global.xml}}
|
3. Add {{JSpringBotGlobal}} library in the in the test suite settings.
| *** Settings *** |
| Library | JSpringBotGlobal |
= Sample Date Keyword Usage =
| Set Date Time Zone | Japan | | # Sets Time Zone to *Time Zone Id*: Japan ; *Raw offset (Hours:Minutes)*: 9 : 00; *Display Name*: Japan Standard Time |
| Print Date Time |
| Set Date Time Format | dd-MM-yyyy HH:mm |
| Print Date Time |
| Format Date Time |
| Add Date Time Days | 90 | | # Add 90 days to current date. |
| Print Date Time |
| Subtract Date Time Days | 40 | | # Subtracts 40 days to current date. |
| Print Date Time |
| Parse Date Time | 2013-02-08 | yyyy-MM-dd | # Sets current date to the date passed with the given format. |
| Print Date Time |
| Reset Date Time | | | # Resets current date. |
| Print Date Time |
= Sample Date Function Usage: =
| ${dateNow}= | EL Evaluate | $[date:now()] |
| ${currentNow}= | EL Evaluate | $[date:current()] |
| Set Date Time Format | yyyy-MM-dd HH:mm:ss |
| Set Date Time Zone | Asia/Taipei | | # Sets date time zone. |
| ${date}= | EL Evaluate | $[date:parse('2013-02-08', 'yyyy-MM-dd')] |
| EL Should Be Equal | $[date:current('+1d +1y -1M')] | 2014-01-09 00:00:00 | # Adds 1 day, 1 year and subtracts 1 month to 2013-02-08 |
| ${sqlDate}= | EL Evaluate | $[date:toSQLDate()] |
| ${sqlTime}= | EL Evaluate | $[date:toSQLTime()] |
| ${sqlTimestamp}= | EL Evaluate | $[date:toSQLTimestamp()] |
| Should Be Equal As Strings | ${sqlDate} | 2013-02-08 |
| Should Be Equal As Strings | ${sqlTime} | 00:00:00 |
| Should Be Equal As Strings | ${sqlTimestamp} | 2013-02-08 00:00:00.0 |
| EL Should Be Equal | $[date:firstDayOfMonth()] | 2013-04-01 00:00:00 | # Returns first day of the month. |
| EL Should Be Equal | $[date:lastDayOfMonth()] | 2013-04-30 00:00:00 | # Returns last day of the month. |
| EL Should Be Equal | $[date:firstDayOfYear()] | 2013-01-01 00:00:00 | # Returns first day of the year. |
| EL Should Be Equal | $[date:isoParse('2013-03-18T15:39:43.000+08:00')] | 2013-03-18 15:39:43 | # Parses an ISO date to set date format |
| EL Should Be Equal | $[date:changeISODateFormat('2013-03-18T15:39:43.000+08:00','yyyy-MM-dd HH:mm:ss.S')] | 2013-03-18 15:39:43.0 | # Parses and ISO date to the specified date format. |
| EL Should Be True | $[date:isBeforeNow()] |
| Print Date Time |