Skip to main content
added 8 characters in body
Source Link
Georgios
  • 20.2k
  • 9
  • 99
  • 100

I am wondering if there is a way to get current milliseconds since 1-1-1970 (epoch) using the new LocalDate, LocalTime or LocalDateTime classes of Java 8.

The known way is below:

long currentMilliseconds = new Date().getTime(); 

or

long currentMilliseconds = System.currentTimeMillis(); 

I am wondering if there is a way to get current milliseconds since 1-1-1970 using the new LocalDate, LocalTime or LocalDateTime classes of Java 8.

The known way is below:

long currentMilliseconds = new Date().getTime(); 

or

long currentMilliseconds = System.currentTimeMillis(); 

I am wondering if there is a way to get current milliseconds since 1-1-1970 (epoch) using the new LocalDate, LocalTime or LocalDateTime classes of Java 8.

The known way is below:

long currentMilliseconds = new Date().getTime(); 

or

long currentMilliseconds = System.currentTimeMillis(); 
added 74 characters in body
Source Link
Georgios
  • 20.2k
  • 9
  • 99
  • 100

I am wondering if there is a way to get current milliseconds since 1-1-1970 using the new LocalDate, LocalTime or LocalDateTime classes of Java 8.

The known way is below:

long currentMilliseconds = new Date().getTime(); 

or

long currentMilliseconds = System.currentTimeMillis(); 

I am wondering if there is a way to get current milliseconds since 1-1-1970 using the new LocalDate, LocalTime or LocalDateTime classes of Java 8.

The known way is below:

long currentMilliseconds = new Date().getTime(); 

I am wondering if there is a way to get current milliseconds since 1-1-1970 using the new LocalDate, LocalTime or LocalDateTime classes of Java 8.

The known way is below:

long currentMilliseconds = new Date().getTime(); 

or

long currentMilliseconds = System.currentTimeMillis(); 
Switch to non-deprecated tag, jsr310 -> java.time
Link
JodaStephen
  • 64k
  • 15
  • 100
  • 118
Add JSR-310 tag
Link
JodaStephen
  • 64k
  • 15
  • 100
  • 118
Loading
Editorial cleanup
Source Link
Stuart Marks
  • 133.5k
  • 39
  • 215
  • 275
Loading
added 16 characters in body
Source Link
Georgios
  • 20.2k
  • 9
  • 99
  • 100
Loading
added 6 characters in body; edited tags
Source Link
Tiny
  • 28k
  • 113
  • 352
  • 611
Loading
Source Link
Georgios
  • 20.2k
  • 9
  • 99
  • 100
Loading