on 07-21-2006 7:51 AM
Hi All
I want to add/delete month/date/year from particular date. Is there any
function avliable in java. IF there please give.
By,
Mody.
Hi,
Using the following code you can add/delete date,month and year.
String DATE_FORMAT = "yyyy-MM-dd";
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
Calendar c1 = Calendar.getInstance();
c1.set(2006, 05 , 30); // 2006 May 30
wdComponentAPI.getMessageManager().reportSuccess("Date is : " + sdf.format(c1.getTime()));
c1.add(Calendar.DATE,5);
c1.add(Calendar.MONTH,5);
c1.add(Calendar.YEAR,5);
wdComponentAPI.getMessageManager().reportSuccess("Date + 5 days is : " +
sdf.format(c1.getTime()));
c1.add(Calendar.DATE,-5);
c1.add(Calendar.MONTH,-5);
c1.add(Calendar.YEAR,-5);
wdComponentAPI.getMessageManager().reportSuccess("Delete Date + 5 days is : " +
sdf.format(c1.getTime()));
Kind Regards
S.Saravanan
Message was edited by: Saravanan S
Message was edited by: Saravanan S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.