Advertisement
FedchenkoIhor

timeExemple

May 20th, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. public static void main(String[] args) throws Exception
  2. {
  3.     Date startTime = new Date();
  4.    
  5.     long endTime = startTime.getTime() + 5000;
  6.     Date endDate = new Date(endTime);
  7.    
  8.     Thread.sleep(3000);
  9.    
  10.     Date currentTime = new Date();
  11.     if (currentTime.after(endDate))
  12.     {
  13.         System.out.println("End time!");
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement