# DayOfWeek

Returns the current day of week.

## Syntax

```typescript
DayOfWeek(): number
```

## Return Value

Returns a `number` representing the day of the week,where:

* 0 represents Sunday
* 1 represents Monday
* 2 represents Tuesday
* 3 represents Wednesday
* 4 represents Thursdays
* 5 represents Friday
* 6 represents Saturday

## Description

The `DayOfWeek` method returns the day of the week for the current time. The returned value is between 0 and 6, where 0 represents Sunday and 6 represents Saturday.

## Example

```typescript
// Get current day of week
const dayOfWeek = this.api.DayOfWeek()
console.log(`Current day of week: ${dayOfWeek}`)

// Get day name
const dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
console.log(`Day name: ${dayNames[dayOfWeek]}`)

// Check for weekend
const isWeekend = dayOfWeek === 0 || dayOfWeek === 6
console.log(`Is weekend: ${isWeekend}`)

// Check for trading day
const isTradingDay = dayOfWeek >= 1 && dayOfWeek <= 5
console.log(`Is trading day: ${isTradingDay}`)

// Get days until weekend
const daysUntilWeekend = dayOfWeek <= 5 ? 5 - dayOfWeek : 0
console.log(`Days until weekend: ${daysUntilWeekend}`)
```
