Skip to main content

I have the day of payment (PayDay value).

and that the next payment will be after 1 month.


I need formula which generates date of next payment,

In correlation based with today, I have to pay either this month or next (the formula decides)


there are some peculiarities

If the payment date of the current month has already passed, PayDayToPayDate is before today, then add a period of +1 month to the date. OK


I solved my task with US Date Format and it works well no bugs there.

But EU is bugged - it increases value of month instead of day value.

Am I making a mistake in the formula?


My code here


US_PayDayToPayDate


IF(PayDay,DATETIME_FORMAT(DATETIME_PARSE(MONTH(NOW()) & "/" & PayDay & "/" & YEAR(NOW()), "L"), "L"),"")

US_NextPayment


IF(US_PayDayToPayDate,IF(US_PayDayToPayDate < DATETIME_FORMAT(NOW(), "L"), DATETIME_FORMAT(DATEADD(US_PayDayToPayDate, 1, 'months'), "L"), US_PayDayToPayDate),"")

EU_PayDayToPayDate


IF(PayDay,DATETIME_FORMAT(DATETIME_PARSE(PayDay & "." & MONTH(NOW()) & "." & YEAR(NOW()), "DD.MM.YYYY"), "DD.MM.YYYY"),"")

EU_NextPayment


IF(EU_PayDayToPayDate,IF(EU_PayDayToPayDate < DATETIME_FORMAT(NOW(), "DD.MM.YYYY"), DATETIME_FORMAT(DATEADD(EU_PayDayToPayDate, 1, 'months'), "DD.MM.YYYY"), EU_PayDayToPayDate),"")

JustForTest


DATETIME_FORMAT(DATEADD(EU_PayDayToPayDate, 1, 'months'), "DD.MM.YYYY")
Be the first to reply!

Reply