Jsp:inserting expiry date in datatable from another table datevalue.

Hi all,

i have 2 tables in sql db.one is registration and other is jobposting.in registration table there is one column datetime which store system date.(for checking when user registered him self)

now there is another table jobposting which have one column for the login date and expiry date.

where -- login date stores the system date and for expiry date -- i want to store a date value that will be 6months more then the date stored in registration table datetime column.

and after storing all the values for job posting i also what to show the output to the same page and give telll the user how many job he have posting till now and the expiry date of his jos posting.

can any one help me

please help me .

[753 byte] By [java@mania] at [2007-11-27 8:43:59]
# 1

Below is some date manipulation code, I have done sometime back. It may be useful for you.

//Expiration date should not be greater than one year from current date.

int[] todayDate = DateUtilities.getTodaysDate();

int today = todayDate[0];

int todayMonth = todayDate[1];

int todayYear = todayDate[2];

String expDate = form.getExpDate();

StringTokenizer st = new StringTokenizer(expDate, "/");

int expMonth = Integer.parseInt(st.nextToken());

int expDay = Integer.parseInt(st.nextToken());

int expYear = Integer.parseInt(st.nextToken());

if(expYear == (todayYear+1))

{

if(! ((expMonth < todayMonth) | (expMonth == todayMonth)) )

{

errors.add("Expiration Date", new ActionError("errors.expdate.nolaterthanyear"));

}else if(expMonth == todayMonth){

if(! ((expDay < today) | (expDay == today)) ){

errors.add("Expiration Date", new ActionError("errors.expdate.nolaterthanyear"));

}

}

}

skp71a at 2007-7-12 20:44:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...