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

Announcements

No record found.

News and Announcements icon
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 489

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

  • Verified answer
    Vijay Yelmame VY Profile Picture
    489 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 555 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 484 Super User 2026 Season 2

#3
CU10121822-0 Profile Picture

CU10121822-0 378

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans