How do I build an Instant
object whose value is one year ago today?
For example if right now is 2015-12-20T11:53
I want an Instant
object containing 2014-12-20T11:53
.
Instant
has a minus
function that receives a Duration
but Duration
doesn't have a years
function. There is a class called Period
that has a Period.years
function but running Period.years(1).toStandardDuration()
throws the following exception:
java.lang.UnsupportedOperationException: Cannot convert to Duration as this period contains years and years vary in length