0

So I’ve used the Lookback API toolkit to gather a bunch of data for any given user story. Right now, I’m interested in doing some calculations using the _ValidFrom time. Mainly some simple “time elapsed” stuff.

What is the best way of going about this? I have done some research about converting the string returned from the query to a SimpleDate, but I am finding that method is somewhat outdated. Perhaps there is some way to access the date directly from the query, without having to do any conversions.

kjmj
  • 412
  • 5
  • 19
  • Without knowing Lookback, if you get `_ValidFrom` as a string and want to calculate elapsed time in Java, you will want to use `java.time` (the modern Java date and time API) and probably its `Duration` class for elapsed time. Links: (1) [Tutorial](https://docs.oracle.com/javase/tutorial/datetime/). (2) [Documentation of `Duration`](https://docs.oracle.com/javase/9/docs/api/java/time/Duration.html). – Ole V.V. Jun 17 '18 at 05:43
  • Unfortunately there are still so many outdated pages floating around from the time when we used `SimpleDateFormat` for parsing a string into a `Date`. Those classes were poorly designed and troublesome to work with and also gave poor support for calculating elapsed time. Today no one should use them. – Ole V.V. Jun 17 '18 at 05:54
  • 1
    Thanks for the info, everyone. For now, I have just extracted the date string and parsed it to a `LocalDateTime` object. From there, I used the `Duration` class for calculations. – kjmj Jun 17 '18 at 22:17

0 Answers0