Legacy Dev Forum Posts

 View Only

Sign Up

Expression for 1st date of next month if today is last of this month

  • 1.  Expression for 1st date of next month if today is last of this month

    Posted 06-05-2025 19:26

    Daniel_Lewis | 2024-11-04 19:50:38 UTC | #1

    In the following expression, if today is a weekday other than Friday, I want to provide the date for tomorrow, otherwise provide a date for 3 days from now.

    The issue is, if the date is the last day of the month, a +1 will cause massive errors and stop calls from being handled.

    If(DayOfWeek(AddHours(GetCurrentDateTimeUtc(),-7)) < 6, MakeDateTime(Year(GetCurrentDateTimeUtc()), Month(GetCurrentDateTimeUtc()), Day(GetCurrentDateTimeUtc())+1, 13, 00, 00), MakeDateTime(Year(GetCurrentDateTimeUtc()), Month(GetCurrentDateTimeUtc()), Day(GetCurrentDateTimeUtc())+3, 13, 00, 00) )

    What's the best way to get the correct first day of the next month if todays date is the last date of this month?


    system | 2024-12-05 19:50:43 UTC | #2

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 30202