fork(2) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. long ms = new Date().getTime();
  14. System.out.println("Current time: " + new Date().toString());
  15. System.out.println("Current time: " + ms);
  16.  
  17. long fifteen = 15 * 60 * 1000;
  18. long newMs = (ms / fifteen) * fifteen + fifteen;
  19. System.out.println("Calculated time: " + new Date(newMs));
  20. System.out.println("Calculated time: " + newMs);
  21. }
  22. }
Success #stdin #stdout 0.04s 711680KB
stdin
Standard input is empty
stdout
Current time: Tue Jan 03 16:45:51 GMT 2017
Current time: 1483461951352
Calculated time: Tue Jan 03 17:00:00 GMT 2017
Calculated time: 1483462800000