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

Community site session details

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

Subtract Time from DateTime Variable

(0) ShareShare
ReportReport
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 

I have the same question (0)
  • Johnson_Patrick Profile Picture
    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
    1,035 Moderator 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,725 Super User 2025 Season 2

#2
Sumit Singh Profile Picture

Sumit Singh 2,610

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,221

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans