Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Is there a way to find last date of month using any function? Like 03/15/2017 should return 03/31/2017? (SAP)


Is there a way to find last date of month using any function? Like 03/15/2017 should return 03/31/2017? Any link over internet would be good?


1 Answer
SAP Expert

You can try using DateSerial() function.

DateSerial returns a Date value for the specified year, month and day. It also handles relative Date expressions.

Arguments:

  • year is a whole Number or numeric expression representing a year, example: 1996.
  • month is a whole Number or numeric expression representing a month, example: 12 for December.
  • day is a whole Number or numeric expression representing a day of the month, example: 5.

Returns:

A Date value.

Action:

DateSerial returns a Date value for the specified year, month and day. It also handles relative Date expressions.

DateSerial (2000, 6, 15)

DateSerial (2004, 1 - 7, 15)

DateSerial (2008, 1, 166)

Check the below code as it finds the first day of next month and then you can go back one day back to get last date of month.

DateSerial

(

 year({table.date},

 month({table.date}) + 1,

1 - 1 ;

)

You can refer this link to know more about this function:


DateSerial



Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.