0

Jeez, this seems like the easiest thing.

I have

def dueFromNow = 30.days.fromNow

dueFromNow is a Deadline, but I need it in standard Unix time. Of course. Like everybody else.

Cannot find it in the docs, the code, or online.

Michael Lorton
  • 43,060
  • 26
  • 103
  • 144

1 Answers1

0

I think there is no any direct conversion. You can get Unix time in Java 8 like this:

java.time.Instant.now().getEpochSecond()

So if have a Deadline, you can get its timeLeft: FiniteDuration and add to that value:

java.time.Instant.now().getEpochSecond() + 30.days.fromNow.timeLeft.toSeconds

It would be simpler to say just 30.days.toSeconds, of course, if you have directly the FiniteDuration.

Community
  • 1
  • 1
laughedelic
  • 6,230
  • 1
  • 32
  • 41