Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

AddDays Function in Calculated Field

(0) ShareShare
ReportReport
Posted on by 50

Hello All, very simple calculation but any idea why I am getting this discrepancy for some dates and not for most. Discrepancies in red.

When I calculate in Excel and other calculators online it increases by 1 date for 3 records. In dynamics I am using Calculated field  AddDays function,  adding 60 days to a date

pastedimage1605896476688v1.png

  • Suggested answer
    Manny Floyd Profile Picture
    Manny Floyd 50 on at
    RE: AddDays Function in Calculated Field

    Thank you Henry for educating me on this. Now I get it.

  • Suggested answer
    Manny Floyd Profile Picture
    Manny Floyd 50 on at
    RE: AddDays Function in Calculated Field

    Hi Karla, that fixed the problem. Thank you so much.

  • Suggested answer
    Henry J. Profile Picture
    Henry J. 5,237 on at
    RE: AddDays Function in Calculated Field

    Thanks Emanuel,

    Behavior: User Local + Format : Date Only actually means that the date is displayed as date field, but it still contains a hidden time part in the user time zone, set to 00:00:00.

    So if I set today's date in that field, I will see 2020-11-20. But it will in fact as store it as 00:00:00 my time zone (say CET).
    In the system DB, it will be stored in UTC, so 2020-11-19 23:00:00 hence potentially displayed as the day before for some users in earlier Time Zone.

    I suspect calculated fields take the UTC value, so potentially with day difference in some situations (user setting the date from a different Time Zone, daylight savings...)

    This article covers the various Date/Time behavior: Working with Time Zones in the Common Data Service | Microsoft Power Apps

    One way to mitigate this, would be to change the behavior to Date Only (if that's indeed what you're trying to capture) - that's not reversible though.

    Henry

  • Suggested answer
    KarlaK Profile Picture
    KarlaK 160 on at
    RE: AddDays Function in Calculated Field

    I recently learned that the Behavior set to User Local can wreak havoc on date-only fields. You have it displaying as Date Only (the format setting) but it's saved in the database as date/time.

    I had a similar situation and after I updated the Behavior to Date Only my problem went away.

  • Manny Floyd Profile Picture
    Manny Floyd 50 on at
    RE: AddDays Function in Calculated Field

    Hi Henry,

    Both fields are date only.

    Date Type : Date and Time

    Field Type : Simple

    Behavior: User Local

    Format : Date Only

    IME Mode : auto

  • Suggested answer
    Henry J. Profile Picture
    Henry J. 5,237 on at
    RE: AddDays Function in Calculated Field

    Quick question: is the date field Date Only or Time Zone Independent?

    I'm wondering if there is a time zone, daylight saving rule that could switch some days from 00:00 to 23:00 the day before in the process.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,433 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans