java - How to Save Upcoming date in string -


how upcoming date in string ... (like 17 april 2020 or 2015) (comparing cuurenttime , futuretime) here trying...

dateformat dateformat = new simpledateformat("yyyy-mm-dd");       calendar cal = calendar.getinstance(); string currenttime = new string(dateformat.format(cal.gettime())); string futuretime = new string (dateformat.format(__________); //how store future date if have current date system.out.println(dateformat.format(cal.gettime()));     

it's current time:

calendar cal2 = calendar.getinstance(); cal2.add(calendar.day_of_month, 3);//a date in future (achieved somehow) string currenttime = new string(dateformat.format(cal.gettime())); string futuretime = new string (dateformat.format(cal2.gettime())); 

note: op said in comments he/she wants compare dates, , it's bad idea compare 2 dates in string formats , suggest use joda time.


Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

php - Redirect and hide target URL -