265
Views
11
Comments
last days of the month
Question

Hi Guys!

I need to calculate the last days of the month of the current year. I have a screen that registers deadlines for registering vacations in the month, based on this information I want to get the last date of each month in this register. Jan last day Feb last day ...


Has anyone needed it or know how to do it? 

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi Fabiano,

This Forge component has the right function to do that and many others.

https://www.outsystems.com/forge/component-overview/9759/date-time-utils

Regards,

Daniel

UserImage.jpg
Fabiano Ferreira

In my case, the company's project does not allow installing plugins, I had even seen this solution in another group

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

You can install the forge component in your PE. Inspect the code, and code the same.

Stupid company rules btw.

UserImage.jpg
Fabiano Ferreira


I open it here in my personal and it will be useful for other functions that I will create, but I agree with the fact that the company does not want to use plugins.

2021-09-06 15-09-53
Dorine Boudry
 
MVP

If you want to calculate yourself, just substract 1 day of the first day of the next month

UserImage.jpg
Fabiano Ferreira

is there any way to get different months in case Jan, Feb, Apr, Mar... ?

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Well, if you want to get it for every month of a given year (variable DesiredYear) just iterate a variable MonthCounter from 1 to 12, and do something like

AddDays(AddMonths(NewDate(DesiredYear, MonthCounter, 1),1), -1)

UserImage.jpg
Fabiano Ferreira
2023-01-26 16-03-24
Ana Agostinho

Hello Fabiano, 

Did you check this forum post? @Daniel Kuhlmann there suggested a way of doing it :) 

Best regards, 

Ana

UserImage.jpg
Fabiano Ferreira

I would have to implement it for each month of the year

2024-10-28 11-09-58
Claudio R Estezi

Olá Fabiano, para obter o último dia do mês, pode fazer assim: AddDays(AddMonths(CurrDate(), 1), -Day(AddMonths(CurrDate(), 1))) 


Aonde CurrDate é a data atual.  Pode substituir pela sua variável ou parâmetro de entrada.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.