17

I am trying to get the current time in millis doing this

DateTime.now.millis

but I get

Property[millisOfSecond]

Which is the way to get the current time in millis with nscala-time?

I want to do this, using the same library

agusgambina
  • 6,229
  • 14
  • 54
  • 94

2 Answers2

37

Alternatively, you can try:

System.currentTimeMillis()
Sean
  • 509
  • 1
  • 3
  • 4
19

My bad, it was

DateTime.now(DateTimeZone.UTC).getMillis()

I leave the answer just in case is useful for someone else.

agusgambina
  • 6,229
  • 14
  • 54
  • 94
  • 2
    `import org.joda.time.{DateTime, DateTimeZone}` – tom10271 Sep 05 '18 at 04:32
  • 3
    Since 2014 `java.time` should be used rather than `joda.time`: LocalDateTime.now() https://stackoverflow.com/questions/5175728/how-to-get-the-current-date-time-in-java/5175900 has a more comprehensive answer – danio Dec 15 '21 at 12:48