# 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`.
