Skip to content

Instantly share code, notes, and snippets.

@robsongomes
Created March 27, 2015 23:09
Show Gist options
  • Save robsongomes/94e2fda37adb8e95477a to your computer and use it in GitHub Desktop.
Save robsongomes/94e2fda37adb8e95477a to your computer and use it in GitHub Desktop.
import java.time.*;
public class InstantTeste {
public static void main(String args[]) {
Instant t1 = Instant.now();
System.out.println(t1);
Instant t2 = t1.plusSeconds(10);
System.out.println("T1 + 10s: " + t2);
Instant t3 = t2.minusSeconds(10);
System.out.println("T2 - 10s: " + t3);
System.out.println("T1 == T3: " + t1.equals(t3)); //true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment