TimeSpan anchor = TimeSpan.of(2013, 12, 16);
Try<Temporal> result = parser.parse(timex, anchor);
Set<TemporalUnit> units = null;
if (result.isSuccess()) {
Temporal temporal = result.get();
if (temporal instanceof Period) {
units = ((Period) temporal).unitAmounts().keySet();
} else if (temporal instanceof PeriodSet) {
units = ((PeriodSet) temporal).period().unitAmounts().keySet();