Anil's Blog is Best Viewed on GOOGLE CHROME

Saturday, May 2, 2009

Comparision of Dates in Controller

OAViewObject oaviewobject1 = (OAViewObject)am.findViewObject("NewEmployeeVO1");

System.out.println("1");
if (oaviewobject1 != null)
{
System.out.println("Inside");
oaviewobject1.reset(); //New line added
oaviewobject1.next(); //new line added
OARow row = (OARow)oaviewobject1.getCurrentRow();


Date sDate =(Date)row.getAttribute("EffectiveStartDate");

Date eDate =(Date)row.getAttribute("EffectiveEndDate");
java.util.Date VChangeDateTime =
new java.util.Date(sDate.timestampValue().getTime());

if (sDate !=null && eDate !=null)
{
long m1 = sDate.timestampValue().getTime() ;
long m2 = eDate.timestampValue().getTime();

long diff = m2 - m1;

int diffDays = Math.round(diff / (24 * 60 * 60 * 1000));

if (diffDays >365)
{
System.out.println("Date is greater than 365");
}
else

{
System.out.println("Date is less than 365");
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.