on 11-25-2008 1:28 PM
Hi All,
I have a date field in which when i enter the date and click on the button I should display the next day in another inputfield.
Ex: If i enter 12th Nov 2008 (11/12/2008)i should get 13th Nov 2008 (11/13/2008)
in the other input field.
Thank You in Advance.
Hi,
Following is the sample code based on todays date
Date dt = new Date(Calendar.getInstance().getTimeInMillis());
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 1);
System.out.println(calendar.getTime());
OR
//Specifically for your sample dates
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MONTH, 10);
calendar.set(Calendar.DATE, 12);
calendar.set(Calendar.YEAR, 2008);
System.out.println(calendar.getTime());
calendar.add(Calendar.DATE, 1);
System.out.println(calendar.getTime());
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
I got the date format right now.This is the code that I have written.
Date d1 = wdContext.currentContextElement.getDate();
calendar.set(d1.getYear() + 1900,d1.getMonth(),d1.getDate());
calendar.add(Calendar.DATE, 1);
int mnth = calendar.get(Calendar.MONTH);
mnth = mnth+1;
wdComponentAPI.getMessageManager().reportSuccess(mnth "/"calendar.get(Calendar.DATE)"/"calendar.get(Calendar.YEAR));
Thankx,
Naaz.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
This is the code I am writing to display the date in the message manager.
wdComponentAPI.getMessageManager().reportSuccess(calendar.get(Calendar.MONTH)"/"calendar.get(Calendar.DATE)"/"calendar.get(Calendar.YEAR));
I am getting the output as :10/8/108.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ayyapparaj,
Thankx for the quick reply.I got the date but its displaying in this format :Thu Nov 13 09:07:58 EST 2008 .I want it as 11/13/2008 format.
Thank You,
Naaz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
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.