on 06-03-2014 12:34 PM
Hello Team,
If my input date is today , then i need to find out the last day of the previous month for the same.
Can someone help me to find out .. how can this be done.
Regards,
Ravi
Hi Ravi,
I have try with this UDF.
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DATE,1);
cal.add (Calendar.DAY_OF_MONTH,-1);
Date lastDateOfPreviousMonth=cal.getTime();
String t=lastDateOfPreviousMonth+"";
return t.substring(24,28)+t.substring(4,7)+t.substring(8,10);
Try in implementing the above UDF and update the results.
Thanks,
Durga
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try the below code.
// get a calendar object
GregorianCalendar calendar = new GregorianCalendar();
// convert the year and month to integers
int yearInt = Integer.parseInt(year);
int monthInt = Integer.parseInt(month);
int dayInt =
Integer.parseInt(day);
// adjust the month for a zero based index
monthInt = monthInt - 1;
// set the date of the calendar to the date provided
calendar.set(yearInt, monthInt, dayInt);
int day = calendar.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);
return Integer.toString(day);
Regards
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
If you want in Java then use the calender function
Calendar aCalendar = Calendar.getInstance();
// add -1 month to current month
aCalendar.add(Calendar.MONTH, -1);
// set DATE to 1, so first date of previous month
aleaCalendar.setCalendar.DATE, 1);
Date firstDateOfPreviousMonth = aCalendar.getTime();
// set actual maximum date of previous month
aleaCalendar.setCalendar.DATE, aleaCalendar.getActualMaximum(Calendar.DAY_OF_MONTH));
//read it
Date lastDateOfPreviousMonth = aCalendar.getTime();
regards,
Harish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
Please try with 'OIL_LAST_DAY_OF_PREVIOUS_MONTH' FM
Give today's day as input you will get last month end date.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.