---
schema_version: "1"
id: c0d30aac55c1d7edc90f6dbd22b48abe7af79f2a7b9a65fc81c3dbfcf55927db
title: "Handlebars Helper Function: datePart"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/handlebars/reference/date-time/mcn-handlebars-reference-date-time-datepart.md
canonical_url: https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-date-time-references/mcn-handlebars-reference-date-time-datepart.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 262ebf7befcae89c1c6acf9895028578b1ee45e74609596eb80bedfd9a0df005
products:
  - Handlebars for Marketing Cloud Next
  - Marketing Cloud
---
# Handlebars Helper Function: datePart

Extracts a specified part of a date or timestamp, such as the day, month, or year.

## Availability

This helper is available in the Winter ’27 release of Marketing Cloud Next.

## Syntax

```handlebars
{{datePart date datePart}}
```

## Parameters

| Parameter  | Type             | Description                                                                                                            |
| ---------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `date`     | String or Object | Required. The date or timestamp from which to extract a date part.                                                     |
| `datePart` | String           | Required. The date part to extract. Possible values: `Y` (year), `M` (month), `D` (day), `H` (hour), or `MI` (minute). |

### Date Input

Specify `date` in these formats:

- **US formats**: `MM/dd/yyyy`, `M/d/yyyy`, `MM/dd/yyyy HH:mm:ss`, `M/d/yyyy h:mm a`, or `M/d/yyyy h:mm:ss a`
- **ISO formats**: `yyyy-MM-dd`, `yyyy-MM-dd HH:mm:ss`, `yyyy-MM-dd'T'HH:mm:ss`, or `yyyy-MM-dd'T'HH:mm:ss.SSSZ`
- **12-hour time**: `M/d/yyyy h:mm a`, `yyyy-MM-dd h:mm a`, or `yyyy-MM-dd h:mm:ss a`
- **Time-only**: `h:mm a` or `h:mm:ss a`

  **note:** If you specify only a time, the helper function uses the current date.

- **Long-form English**: `d MMMM yyyy`, `MMMM d, yyyy`, or `EEEE, MMMM d, yyyy`
- **Chinese or Japanese notation**: `yyyy年M月d日`
- **Korean notation**: `yyyy년 M월 d일` or `yyyy년M월d일`

## Return Value

The function returns the requested date part as an integer. For example, `{{datePart "2023年8月5日" "Y"}}` returns `2023`.
