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

computed column of view - How to return date difference in days between todays date and record creation datetime

(0) ShareShare
ReportReport
Posted on by 476

HI All,
I am implementing a requirement where I want to return date difference between creation date time and today's date.  have tried like below but not getting expected result. Please suggest the approch. 

 private static server str compColumnApprovalDays()
    {
      

        #define.CompView(AllPOLinesView)
        #define.CompDS(PurchLine)
        #define.FieldCreatedDateTime("CreatedDateTime")

        str todayDate = strFmt("%1", DateTimeUtil::getToday(DateTimeUtil::getUserPreferredTimeZone()));

        str fromDate =  SysComputedColumn::returnField(tableStr(#CompView), identifierStr(#CompDS), fieldStr(#CompDS, #FieldCreatedDateTime));

        str test = SysComputedColumn::getDateDiff(fromDate,todayDate);

      

        return test;
    }

in DB i am able to see the values as shown below.
pastedimage1673328724803v1.png

I have the same question (0)
  • Verified answer
    Vijay Yelmame VY Profile Picture
    476 on at

    This is resolved. Please don't invest your time.


    private static server str compColumnApprovalDays()
    {
    
        return SysComputedColumn::getDateDiff(
                    SysComputedColumn::returnField(tableStr(AllPOLinesView), identifierStr(PurchLine),
                                            fieldId2name(tableNum(PurchLine),fieldNum(PurchLine, CreatedDateTime))),
                SysComputedColumn::getCurrentUtcDate(),
            SysComputedColumnDatePart::Day);
       
    }

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