Question: When setting issue estimates in JIRA, you can enter a string like `"1d 2h 30m"` and JIRA will translate this (I'm assuming) into a corresponding number of milliseconds.

Is there an available Java library that does this?

I'm using a Spring managed bean that takes a property indicating how often a directory ought to be purged, and I'd like to allow the configuration to take a human-readable string rather than an explicit number of milliseconds.

Alternatively, if there's a better approach I'm not thinking of, I'd love to hear it.

Answer: 
Take a look at [joda-time](http://joda-time.sourceforge.net/)'s [PeriodConverter](http://joda-time.sourceforge.net/api-release/org/joda/time/convert/PeriodConverter.html). I have never used this part of the joda-time library myself, but it looks like it does what you need.

In general, for date/time stuff, look at joda-time first :)
```
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateTest {
    public static void main(String[] args) {
        DateFormat df = new SimpleDateFormat("dd'd' HH'h' mm'm'");
        try {
            Date d = df.parse("1d 2h 30m");
            System.out.println(d.getTime());
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
}

```