Guest User

Untitled

a guest
Feb 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. Calendar.getInstance();
  2.  
  3. Date now = new Date(); // Gets the current date and time
  4. int year = now.getYear(); // Returns the # of years since 1900
  5.  
  6. Calendar now = Calendar.getInstance(); // Gets the current date and time
  7. int year = now.get(Calendar.YEAR); // The current year
  8.  
  9. GregorianCalendar gc = new GregorianCalendar(System.getCurrentTimeMillis());
  10. int year = gc.get(Calendar.YEAR);
Add Comment
Please, Sign In to add comment