Android examples for java.util:Date Format
Get date After date in yyyy-MM-dd format
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static String dateAfter(String datestring, int after) { String afterDateString = ""; Date date = null;//from w ww.ja v a2 s . co m SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); try { date = df.parse(datestring); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.DAY_OF_MONTH, after); date = calendar.getTime(); afterDateString = df.format(date); } catch (Exception e) { e.printStackTrace(); } return afterDateString; } }