Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

How to calculate in a formula the number of the days since start the year with the current day

Posted on by 465
Hi Community,
 
Do you know how to calculate in a formula the number of the days since start of the year with the current day?
 
In this case, I want to replace the number 116 that is the number of the days since start the year, with a field or variable that calculate this number automatically.
 
 
If you know how I would appreciate it.
 
Thanks
 
  • Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 9,559 Super User 2024 Season 2 on at
    How to calculate in a formula the number of the days since start the year with the current day
    Hi @Manuel,
     
    Please verify the answers that helped.
     
    Mohamed Amine MAHMOUDI
  • Verified answer
    Manuel Lozada Profile Picture
    Manuel Lozada 465 on at
    How to calculate in a formula the number of the days since start the year with the current day
    Thanks Mohamed I solved the problem according your code and Renteria link.
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 9,559 Super User 2024 Season 2 on at
    How to calculate in a formula the number of the days since start the year with the current day
    Hi @Manuel,
     
    to calculate the number of days you need to use this code:
    var
        dt: date;
        year: Integer;
        days : Integer;
    begin
        year := Date2DMY(Today(), 3);
        dt := DMY2Date(1,1,year);
        days:= Today() - dt;
    end;
    Best regards,
    Mohamed Amine MAHMOUDI
  • gdrenteria Profile Picture
    gdrenteria 12,183 Most Valuable Professional on at
    How to calculate in a formula the number of the days since start the year with the current 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans