# parseYearFromDateTime

Industry: Core

## Signature

```ts
parseYearFromDateTime(value: string): string
```

Return the year for a given ISO 8601 datetime string.

- Returns the year as Temporal writes it: four digits (`"2024"`, `"0005"`), or a sign and six digits outside 0000–9999 (`"+010000"`, `"-000005"`).
- Returns "" for invalid input.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` | ISO datetime string |

## Returns

the year as four digits, or a sign and six digits outside 0000–9999, or "" on invalid input

## Examples

```ts
import { parseYearFromDateTime } from "@northguild/gmt/plain/parse";

parseYearFromDateTime("2024-03-15T12:30:00") // "2024"
```

## Source

[plain/parse/parseYearFromDateTime.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/plain/parse/parseYearFromDateTime.ts)
