Updates:
        Summary: Library for date/time conversion and calculation
        Owner: pekka.klarck
        Cc: [email protected]
        Labels: -Target-2.9 Target-2.8.5

Comment #24 on issue 415 by pekka.klarck: Library for date/time conversion and calculation
http://code.google.com/p/robotframework/issues/detail?id=415

We try to get this library implemented for RF 2.8.5. Janne and I had a design discussion today and agreed to implement following keywords. Except keyword names and other details are still subject to change.

1) 'Convert Date'. Converts dates from and to different formats. We plan to support at least:

- Timestamps in format '2014-04-24 21:45:12.123'. On input this format accepts any non-numbers as separators (this allows 'T' between data and time as mandated by ISO 8601) and pads missing numbers from right with 0. For example just '20140424' would be valid.

- Timestamps in custom format parsed by datetime.strptime <https://docs.python.org/2.7/library/datetime.html#datetime.datetime.strptime>.

- Python datetime and date objects <https://docs.python.org/2.7/library/datetime.html>.

- Seconds since epoch.

In most cases the input format can be guessed based on the object type, but the keyword will also allow explicitly stating the format. Output format can also be specified, but the default will be timestamp in format '2014-04-24 21:45:12.123'.

2) 'Convert Time'. Converts times in different formats:

- Time strings in Robot's format (e.g. '1 day 23 hours').

- Seconds as integer or float.

- timedelta objects <https://docs.python.org/2.7/library/datetime.html#datetime.timedelta>,

Figuring out input type and specifying return type will work like with 'Convert Data'. The default return type will be float.

3) 'Subtract Dates'. Allows calculating difference between two dates. Dates can be given in formats supported by 'Convert Date' and result can be returned using formats supported by 'Convert Time'.

4) 'Add to Date'. Allows adding a time duration to a date. Date can be given in same formats as supported by 'Convert Date' and time in formats supported by 'Convert Time'. Return value will be date.

5) 'Subtract from Date'. Allows subtracting a time duration from a date. Inputs and outputs identicla to 'Add to Date'.

6) We probably will also implement 'Get Current Date'. It would work similarly as current 'BuiltIn.Get Time', but would support same date formats as 'Convert Date'. Alternatively we may enhance 'Get Time' (likely hard due to backwards-compatibility requirements) or just decide this isn't needed.

7) We may also implement 'Should Be Date' and 'Should Be Time' for verifying dates/times. They would probably be very handy in testing other keywords and there could also be some real life use cases.

8) We probably won't implement comparison keywords. The reason is that keywords like 'Should Be True' and 'Run Keyword If' already handle expressions like `${date1} > ${date2}` if dates are in uniform format. We also discussed about a possibility to add separate generic comparison keywords later.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--

--- You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to