---
id: post/yzhums-com/68755
type: post
title: "Dynamics 365 Business Central: How to add or subtract hours from a DateTime field"
summary: Adding or subtracting hours from DateTime fields in Business Central can be done using the AddHoursToDateTime procedure from the Type Helper codeunit. This is useful for timezone conversions and date-time manipulations in AL code.
tier: community
language: en
tags:
  - datetime
  - type helper
  - al code
  - duration
  - timezone conversion
system: development
review:
  state: reviewed
  by: opus
  at: "2026-10-26T06:41:06.578Z"
  flags: []
generated:
  at: "2026-10-26T05:51:10.938Z"
  pipeline: 0.2.0
  prompts:
    extract-post: 1
  input_hash: b0929850ac9bbc5911e707e212a236b7fedcb2516b180e588dcf3ec50e14d682
evidence:
  - kind: blog
    url: https://yzhums.com/68755/
    title: "Dynamics 365 Business Central: How to add or subtract hours from a DateTime field"
    date: "2026-01-21"
    commit: null
    t: null
    quote: null
  - kind: blog
    url: https://yzhums.com/68755/
    title: "Dynamics 365 Business Central: How to add or subtract hours from a DateTime field"
    date: "2026-01-21"
    commit: null
    t: null
    quote: if you only need to add or subtract hours from a DateTime field, there's an even simpler method
links:
  learn: []
  objects:
    - object/codeunit/10
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  related:
    - to: post/yzhums-com/70931
      title: "Dynamics 365 Business Central: How to add a “TAB” character to a string via AL"
      label: possibly related
      why: both name Codeunit 10 "Type Helper"
      by: code
    - to: post/yzhums-com/74458
      title: "Dynamics 365 Business Central: How to add Filter by item attributes to the Item Ledger Entries page"
      label: possibly related
      why: both name Codeunit 10 "Type Helper"
      by: code
    - to: post/yzhums-com/69896
      title: "Dynamics 365 Business Central: How to add Notes (System Parts) from FactBox to a report"
      label: possibly related
      why: both name Codeunit 10 "Type Helper"
      by: code
    - to: post/yzhums-com/70481
      title: "Dynamics 365 Business Central: How to convert Month Name (Text) to Month Number (Integer)"
      label: possibly related
      why: both name Codeunit 10 "Type Helper"
      by: code
    - to: post/aardvarklabs-blog/2678
      title: "Understanding AL Development: The Type Helper Code Unit"
      label: possibly related
      why: both name Codeunit 10 "Type Helper"
      by: code
post_id: "68755"
source_id: yzhums-com
source_name: Dynamics 365 Lab - Yun Zhu
url: https://yzhums.com/68755/
published_at: "2026-01-21T01:47:48.000Z"
author: Yun Zhu
full_text: false
words: 269
quotes:
  - text: if you only need to add or subtract hours from a DateTime field, there's an even simpler method
    why_it_matters: Highlights that AddHoursToDateTime is a convenient alternative to Duration calculations for hour-only adjustments
code_objects_mentioned:
  - codeunit Type Helper
systems:
  - development
versions_mentioned: []
preview:
  embeddable: true
  frame_url: null
  image: https://yzhums.com/wp-content/uploads/2026/01/image-117.png
  image_alt: null
  image_w: null
  image_h: null
  site_name: Dynamics 365 Lab
  favicon: https://yzhums.com/wp-content/uploads/2020/08/cropped-logo-3-32x32.png
  probed_at: "2026-10-26T06:10:02.506Z"
---

# Dynamics 365 Business Central: How to add or subtract hours from a DateTime field

[Read the post](https://yzhums.com/68755/) · Dynamics 365 Lab - Yun Zhu (Yun Zhu, MVP) · 2026-01-21 · 269 words · tier community · reviewed (checked by Opus)

> Adding or subtracting hours from DateTime fields in Business Central can be done using the AddHoursToDateTime procedure from the Type Helper codeunit. This is useful for timezone conversions and date-time manipulations in AL code.

## Key points

- The Type Helper codeunit provides an AddHoursToDateTime procedure for simple hour arithmetic on DateTime fields
- Pass positive values to add hours and negative values to subtract hours
- This method is simpler than working with Duration data type when you only need to adjust hours
- Timezone conversions can be achieved by adding or subtracting hours based on the offset between UTC and the target timezone

## Quotes

- "if you only need to add or subtract hours from a DateTime field, there's an even simpler method" (Highlights that AddHoursToDateTime is a convenient alternative to Duration calculations for hour-only adjustments)

## AL objects mentioned

As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.

- [codeunit 10 "Type Helper"](../../objects/codeunit/10.md)

## Possibly related

No source states these links: they share an object, a model read them, or a person found the same subject.

- [Dynamics 365 Business Central: How to add a “TAB” character to a string via AL](../../posts/yzhums-com/70931.md) — possibly related: both name Codeunit 10 "Type Helper"
- [Dynamics 365 Business Central: How to add Filter by item attributes to the Item Ledger Entries page](../../posts/yzhums-com/74458.md) — possibly related: both name Codeunit 10 "Type Helper"
- [Dynamics 365 Business Central: How to add Notes (System Parts) from FactBox to a report](../../posts/yzhums-com/69896.md) — possibly related: both name Codeunit 10 "Type Helper"
- [Dynamics 365 Business Central: How to convert Month Name (Text) to Month Number (Integer)](../../posts/yzhums-com/70481.md) — possibly related: both name Codeunit 10 "Type Helper"
- [Understanding AL Development: The Type Helper Code Unit](../../posts/aardvarklabs-blog/2678.md) — possibly related: both name Codeunit 10 "Type Helper"

## Context

- Features: DateTime manipulation, AddHoursToDateTime procedure, timezone conversion, Duration data type

Source: Dynamics 365 Lab - Yun Zhu, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.
