Advertisement
ArranUbels

Untitled

Dec 12th, 2012
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. import java.util.Calendar;
  2. import java.util.Date;
  3.  
  4. /**
  5.  * Created with IntelliJ IDEA.
  6.  * User: aubels
  7.  * Date: 12/12/12
  8.  * Time: 9:54 AM
  9.  * To change this template use File | Settings | File Templates.
  10.  */
  11. public class d12 {
  12.     public static void main(String[] args)
  13.     {
  14.         Calendar calendar = Calendar.getInstance();
  15.         calendar.set(2012,Calendar.DECEMBER,12,0,0,0);
  16.         System.out.println(calendar.getTime().toString());
  17.         calendar.add(Calendar.DATE, 1);
  18.         calendar.add(Calendar.MONTH, 1);
  19.         calendar.add(Calendar.YEAR, 1);
  20.         System.out.println(calendar.getTime().toString());
  21.     }
  22. }
  23.  
  24.  
  25. Returns:
  26. Wed Dec 12 00:00:00 EST 2012
  27. Mon Jan 13 00:00:00 EST 2014
  28.  
  29.  
  30. See 13/13/13 does exist.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement