on 04-29-2014 7:46 PM
Hello SAP Gurus,
I have to find the last date of the last month based on today's date
Can someone help me that how can i achieve that either with UDF or with some other method.
Regards,
Ravi
Can you try with below UDF?
Calendar cal = Calendar.getInstance();
cal.add(Calendar.MONTH, -1);
cal.set(Calendar.DATE, 1);
cal.set(Calendar.DATE, cal.getActualMaximum(Calendar.DATE));
Date lastDateOfPreviousMonth = cal.getTime();
DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
String lastDate = df.format(lastDateOfPreviousMonth);
return lastDate;
reference : datetime - How to get the first date and last date of the previous month? (Java) - Stack Overflow
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 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.