fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.text.SimpleDateFormat;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. SimpleDateFormat moscowTime = new SimpleDateFormat("dd.MM.yyyy, HH:mm:ss");
  14. moscowTime.setTimeZone(TimeZone.getTimeZone("Europe/Moscow"));
  15. System.out.println("Calendar");
  16. Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("Europe/Moscow"));
  17. cal.set(2008, Calendar.JULY,1,11,0,0);
  18. System.out.println(moscowTime.format(cal.getTime()));
  19. int idt = 3_500_000;
  20. cal.add(Calendar.MINUTE, idt);
  21. System.out.println(moscowTime.format(cal.getTime()));
  22. System.out.println(cal.getTimeZone().getRawOffset()/60_000);
  23. }
  24. }
Success #stdin #stdout 0.1s 380864KB
stdin
Standard input is empty
stdout
Calendar
01.07.2008, 11:00:00
26.02.2015, 00:20:00
240