fork download
  1. import java.time._
  2.  
  3. object Main extends App {
  4.  
  5. println("app started")
  6.  
  7. // create zoned datetime for 1st Jan 2018, 10am UTC
  8. val zdt1 = ZonedDateTime.of(2018, 1, 1, 10, 0, 0, 0, ZoneId.of("UTC"))
  9. val zdt2 = ZonedDateTime.parse("2018-01-01T10:00:00Z")
  10.  
  11. println(s"COMPARING: $zdt1 and $zdt2")
  12. println("== check: " + (zdt1 == zdt2))
  13. println(".equals check: " + (zdt1.equals(zdt2)))
  14. println(".isEqual check " + (zdt1.isEqual(zdt2)))
  15.  
  16. println("app finished")
  17. }
Success #stdin #stdout 0.5s 67508KB
stdin
Standard input is empty
stdout
app started
COMPARING: 2018-01-01T10:00Z[UTC] and 2018-01-01T10:00Z
== check:      false
.equals check: false
.isEqual check true
app finished