prograMNewbie
asked on
Convert a string("dd-mm-yy") to type date and the reverse of .add method
Is it possible to convert a string in this format : "dd-mm-yy" to type date so .add operation can be perfomed on it. As in:
String date = rs112.getString("expdate")
Calendar finishDate = Calendar.getInstance(date)
finishDate.add(Calendar.DA
Is there a reverse method of .add so that a date can be rolled back a certain number of days?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yy ");
String date = rs112.getString("expdate") ;
Calendar finishDate = Calendar.getInstance();
finishDate.setTime(sdf.par se(date));
finishDate.add(Calendar.DA Y_OF_YEAR, roll_amt);
String date = rs112.getString("expdate")
Calendar finishDate = Calendar.getInstance();
finishDate.setTime(sdf.par
finishDate.add(Calendar.DA
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry about the delay, CEHZ: Your code worked perfect, thanks
Thanks objects for ur comments
Thanks objects for ur comments
,8-)
Glad I could help :)
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yy
finishDate.setTime(sdf.par