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 487

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
    487 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 577 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 309

#3
Diego Mancassola Profile Picture

Diego Mancassola 259

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans