web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to check add days

(0) ShareShare
ReportReport
Posted on by 351

Hi all,

I want to validation if date expired.

I.e :-  Date d = DatetimeUtil::date(DatetimeUtil::addDays(today (), 2));

Return: // 9/16/2022

If the date has 9/17/2022 then i want to validation.

If(d > today () ) // correct me if I'm wrong l.

{

}

Thanks 

I have the same question (0)
  • GirishS Profile Picture
    27,827 Moderator on at

    Hi waytod365,

    Issue is not clear. Can you elaborate.

    How you are getting 9/17/2022.

    Is this a constant value?

    Thanks,

    Girish S.

  • waytod365 Profile Picture
    351 on at

    Thanks for your reply Girish,

    No, it's not constant value. I have a integer Field for that.

  • GirishS Profile Picture
    27,827 Moderator on at

    So if the date d values returns 9/17/2022, then you need a validation for that?

    Thanks,

    Girish S.

  • waytod365 Profile Picture
    351 on at

    Yes!  Date d = DatetimeUtil::date(DatetimeUtil::addDays(this.transDate), this.noOfCalDate));

    NoOfCalDate right now = 2.

    TransDate.   = Today ().

    Thanks for your attention.

  • GirishS Profile Picture
    27,827 Moderator on at

    Date d = DatetimeUtil::date(DatetimeUtil::addDays(this.transDate), this.noOfCalDate));
    Date d1 = mkdate(17,9,2022)
    
    If(d == d1)
    {
        //add validations.
    }
    
     

    If the date after adding number of days will be equal to 9/17/2022 then it will throw validation.

    Thanks,

    Girish S.

  • waytod365 Profile Picture
    351 on at

    Thanks for your answer,

    Actually, i have already transDate while creating form today date set.

    NoOfCalDate in the setup form. ( I can give whatever number)

    Etc:

    If i set the NoOfCalDate 5 in the setup form.

    USMF-00020 i created record today.

    Same USMF-00020 records i will come after 5 days. In this case if i change anything that form. "Date already expired" i want to validation error message. Hope it's clear now.

    I don't wanna check equal. I want to check if the date expired or not.

    Thanks

  • Verified answer
    GirishS Profile Picture
    27,827 Moderator on at

    Date d = DatetimeUtil::date(DatetimeUtil::addDays(this.transDate), this.noOfCalDate));
    Date d1= today();
    // d less then d1
    if(d < d1)
    {
        //date expired
    }

    Thanks,

    Girish S.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 592 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 478 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans