# GetWeekByDateTime

Returns the week number from an FTODate object.

## Syntax

```typescript
GetWeekByDateTime(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 week number of the year (1-53).

## Description

The `GetWeekByDateTime` method extracts the week number from an [`FTODate`](https://fto-2.gitbook.io/fto-strategies-docs/strategies/fto-date) object. The returned value is between 1 and 53, representing the week of the year.

## Example

```typescript
// Create FTODate object
const currentDate = this.api.TimeCurrent();
const week = this.api.GetWeekByDateTime(currentDate);
console.log(`Week number: ${week}`);

// Calculate weeks remaining in year
const totalWeeks = 52;
const weeksRemaining = totalWeeks - week;
console.log(`Weeks remaining: ${weeksRemaining}`);

// Check if it's first or last week
const isFirstWeek = week === 1;
const isLastWeek = week >= 52;
console.log(`First week: ${isFirstWeek}`);
console.log(`Last week: ${isLastWeek}`);

// Format date with week
const year = currentDate.yearOf();
console.log(`Week ${week} of ${year}`);
```
