on 12-05-2008 10:46 AM
hi,
I have the following requirement:
I have a source field as "DOJ" and Target Field as "Date"
I want the output as follows:
Input:
DOJ = 12/12/2008 (dd/MM/yyyy)
Output:
Date =13/12/2008 (dd/MM/yyyy)
the requirement is whenever the source filed ie (DOJ) is given a value ie date ="12/12/2008" then the target filed ie (Date) should give the next day's date ie 13/12/2008
pls do let me know ......how to do this .........?
Thanks .........!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can just create a User defined function an add 1 to your day in the date.
Substring your current date to get month, day and year into seperate variables.. then u can just add one to your day and re group it as a single string..
here is a sample code
String date = "12/04/2008";
String day = date.substring(0,2);
String month = date.substring(3,5);
String year = date.substring(6,10);
int next =Integer.parseInt(day)+1;
String nextDay = String.valueOf(next);
String nextDate = nextDay + "/" +month "/"year;
Hope it helps.
Cheers
Mohan.
Edited by: Krishnamohan Adiraju on Dec 5, 2008 12:13 PM
Edited by: Krishnamohan Adiraju on Dec 5, 2008 12:14 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this UDF it will surely work;
try
{
Date dat = new SimpleDateFormat("dd/MM/yyyy").parse(a[0]);
Calendar cal = new GregorianCalendar();
cal.setTime(dat);
cal.add(Calendar.DAY_OF_MONTH, +1);
Date bar = cal.getTime();
String expDate = new SimpleDateFormat("dd/MM/yyyy").format(bar);
result.addValue(expDate);
}
catch(Exception ex)
{
System.out.println(ex);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.