cancel
Showing results for 
Search instead for 
Did you mean: 

DateFeilds

former_member1193316
Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (1)

Answers (1)

Former Member
0 Kudos

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.