# GetYearByDateTime

Returns the year from an FTODate object.

## Syntax

```typescript
GetYearByDateTime(ftoDate: FTODate): number
```

## Parameters

* `ftoDate`: [`FTODate`](https://fto-2.gitbook.io/fto-strategies-docs/strategies/fto-date) - The FTODate object to extract the day from

## Return Value

Returns a `number` representing the year.

## Description

The `GetYearByDateTime` method extracts the year from an [`FTODate`](https://fto-2.gitbook.io/fto-strategies-docs/strategies/fto-date) object. The returned value is a four-digit year number (e.g., 2024).

## Example

```typescript
// Create FTODate object
const currentDate = this.api.TimeCurrent();
const year = this.api.GetYearByDateTime(currentDate);
console.log(`Year: ${year}`);

// Check if leap year
const isLeapYear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
console.log(`Is leap year: ${isLeapYear}`);

// Format full date
const month = currentDate.monthOf();
const day = currentDate.dayOfMonth();
console.log(`Date: ${year}.${month}.${day}`);

// Calculate years since a reference date
const referenceDate = this.api.createFTODate(new Date("2000-01-01"));
const referenceYear = this.api.GetYearByDateTime(referenceDate);
const yearsSince = year - referenceYear;
console.log(`Years since ${referenceYear}: ${yearsSince}`);
```
