Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Subtract Time from DateTime Variable

Posted on by 100

Hi,

I am looking to subtract Time from a DateTime Variable.

For Eg: If I -6 hrs from the DateTime Variable = 21-03-23 03:00:00 AM, it should return me 20-03-23 09:00:00 PM. 

Let me know if you can help. 

Thanks

Johnson Patrick 

  • Johnson_Patrick Profile Picture
    Johnson_Patrick 100 on at
    RE: Subtract Time from DateTime Variable

    Hi,

    Thanks for your reply. My offset time is stored as a Integer, so how do i use integer variable to subtract from the DateTime variable?

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Subtract Time from DateTime Variable

    Use the duration datatype and say

    TimeDate + Duration := NewDateTime as documented here:

    learn.microsoft.com/.../duration-data-type

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans