on 01-24-2008 5:56 AM
Hi,
I m having two input fields.
1st input field is displaying current date. i used the below code to display the current date.
Date d1 = new Date(System.currentTimeMillis());
wdContext.currentnodeelement.setattribute(d1);
now my requirement is the second input field also should display the date of one week difference of current date.
how could i calculate and dispaly in second input field.
thnaks in advance
Hi,
For that you need to calulate miliseconds for one week which comes out to:
604800000.
For week before:
Date d2 = new Date(System.currentTimeMillis()-604800000);
wdContext.currentnodeelement.setattribute(d2);
For week after:
Date d2 = new Date(System.currentTimeMillis()+604800000);
wdContext.currentnodeelement.setattribute(d2);
thanks & regards,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
After getting the date in to the attribute,make the attribute data type of the second input field to date.Then you add 7 days to the current making use of the methods available with the 'date' datatype.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.