Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. msDelay = Long.parseLong(args.get(2)) - System.currentTimeMillis();
  2.  
  3. //inside a listener
  4. new java.util.Timer().schedule(
  5. new java.util.TimerTask() {
  6. @Override
  7. public void run() {
  8. mySyncMethod();
  9.  
  10. }
  11. },
  12. msDelay
  13. );
  14.  
  15. void schedule(TimerTask task, Date time)
  16. Schedules the specified task for execution at the specified time.
  17.  
  18. void schedule(TimerTask task, long delay)
  19. Schedules the specified task for execution after the specified delay.
  20.  
  21. long millis = 123456780000;
  22. Calendar calendar = Calendar.getInstance();
  23. calendar.setTimeInMillis(millis);
  24. Date date = calendar.getTime();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement