Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int inputDate=20121220;
- int inputDate = 20121220;
- DateFormat df = new SimpleDateFormat("yyyyMMdd");
- Date date = df.parse(String.valueOf(inputDate));
- String s = date.format(date);
- int output = Integer.valueOf(s);
- Calendar cal = Calendar.getInstance();
- String input = String.valueOf(inputDate);
- cal.set(Calendar.YEAR, Integer.valueOf(input.substring(0, 4)));
- cal.set(Calendar.MONTH, Integer.valueOf(input.substring(4, 6)) - 1);
- cal.set(Calendar.DAY_OF_MONTH, Integer.valueOf(input.substring(6)));
- Date date = cal.getTime();
Add Comment
Please, Sign In to add comment