> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# YearSchedule

> This class is used to represent a year schedule. A year can be composed of several WeekSchedules.

This class is used to represent a year schedule. A year can be composed of several WeekSchedules.

## Constructors

### YearSchedule()

```crmscript theme={null}
YearSchedule
```

This class is used to represent a year schedule. A year can be composed of several WeekSchedules.

## Methods

## addTimeSpan(DateTime,TimeSpan)

This function adds a time span to the current year schedule.

```crmscript theme={null}
DateTime addTimeSpan(DateTime dt, TimeSpan sp)
```

**Returns:** [CRMScript.Global.DateTime](CRMScript.Global.DateTime)

## addWS(WeekSchedule,Integer,Integer)

This function adds a week schedule to the year schedule.

```crmscript theme={null}
Void addWS(WeekSchedule ws, Integer mStop, Integer dStop)
```

**Returns:** [CRMScript.Global.Void](CRMScript.Global.Void)

## getDifference(DateTime,DateTime)

Gets difference between two given times. The function returns a timespan.

Counting will skip inactive periodes, defined by the different weekschedules that may be crossed.

```crmscript theme={null}
TimeSpan getDifference(DateTime from, DateTime to)
```

**Parameters:**

| Name | Type                                                   | Description           |
| ---- | ------------------------------------------------------ | --------------------- |
| from | [CRMScript.Global.DateTime](CRMScript.Global.DateTime) | Count from this date. |
| to   | [CRMScript.Global.DateTime](CRMScript.Global.DateTime) | Count to this date.   |

**Returns:** [CRMScript.Native.TimeSpan](CRMScript.Native.TimeSpan)


## Related topics

- [Namespace CRMScript.Native](/en/automation/crmscript/reference/CRMScript.Native.md)
- [CRMScript Reference](/en/automation/crmscript/reference/index.md)
- [WeekSchedule](/en/automation/crmscript/reference/CRMScript.Native.WeekSchedule.md)
- [schedule table](/en/database/tables/schedule.md)
- [Schedule repeating follow-up](/en/diary/learn/recurrence/create.md)
- [Schedule tasks for Travel gateway](/en/onsite/travel/travel-gateway/schedule.md)
