cancel
Showing results for 
Search instead for 
Did you mean: 

Some problem in date calculation?

Former Member
0 Kudos

hi

I have created two views with my input field UI element of type date.Actually problem is that i want date in my second view input field to be not more than the date in my first view input field UI element and if it is the case it show some error.Please provide me with this logic?

regards

Nidhideep

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

assuming you're working with wdp for Java:

Date d1 = wdContext.currentElement.getSomeDate1();

Date d2 = wdContext.currentElement.getSomeDate2();

if (d1.before(d2)) {

// d1 is before d2

} else {

// d1 is after d2

}

Good luck, Roelof

Former Member
0 Kudos

hi

Roelof and Sridhar thanx for your help.I have awarded the points to you both.

Regards

Nidhideep

Answers (1)

Answers (1)

sridhar_k2
Active Contributor
0 Kudos

Hi Nidhideep ,

For your requirement you can create a context variable(date) in the Controller, from the first view assign date to the context variable and from second view just get this variable and check with the local variable with the below condition.

Date d1 = // Get first view variable

Date d2 = // Get second view variable

if(dd.before(d2)){

}else{

}

Regards,

Sridhar