Guest User

Untitled

a guest
Oct 27th, 2015
26
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.BlinG.Code;
  2.  
  3. import java.text.DateFormat;
  4. import java.util.Date;
  5. import java.util.Locale;
  6.  
  7. public class GetTime20 extends Thread {
  8.  
  9. public void run() {
  10.  
  11. Date rightNow;
  12. Locale currentLocale;
  13. DateFormat timeFormatter;
  14. DateFormat dateFormatter;
  15. String timeOutput;
  16. String dateOutput;
  17.  
  18. for (int i = 1; i <= 20; i++) {
  19.  
  20. rightNow = new Date();
  21. currentLocale = new Locale("en", "US");
  22.  
  23. timeFormatter = DateFormat.getTimeInstance(DateFormat.DEFAULT, currentLocale);
  24. dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT, currentLocale);
  25.  
  26. timeOutput = timeFormatter.format(rightNow);
  27. dateOutput = dateFormatter.format(rightNow);
  28.  
  29. System.out.println(timeOutput);
  30. System.out.println(dateOutput);
  31. System.out.println();
  32.  
  33. try {
  34. Thread.sleep(2000);
  35. } catch (InterruptedException e) {
  36.  
  37. }
  38.  
  39. }
  40.  
  41. }
  42.  
  43. }
RAW Paste Data