> For the complete documentation index, see [llms.txt](https://docs.tivity.one/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tivity.one/building-an-application/execution/scripting/functions/date-actions.md).

# Date

## AddToDateTime

Adds a given part value to the given DateTime.

#### Syntax <a href="#pragma-line-2941" id="pragma-line-2941"></a>

```
AddToDateTime ( Part , Value , DateTime )
```

#### Parameters <a href="#pragma-line-2947" id="pragma-line-2947"></a>

***Part as String (required)***\
&#x20;Allowed values are 'Time', 'Year', 'Quarter', 'Month', 'Week', 'Day', 'Hour', 'Minute', 'Second', 'Millisecond' and 'Tick' (case-insensitive, can be pluralized).\
&#x20;Type: String

***Value***\
&#x20;The value to add to the DateTime.\
&#x20;Type: Any

***DateTime***\
&#x20;The DateTime to alter.\
&#x20;Type: DateTime

#### Return Type <a href="#pragma-line-2962" id="pragma-line-2962"></a>

DateTime

## AddToTimeSpan

Adds a given part value to the given TimeSpan.

#### Syntax <a href="#pragma-line-2971" id="pragma-line-2971"></a>

```
AddToTimeSpan ( Part , Value , TimeSpan )
```

#### Parameters <a href="#pragma-line-2977" id="pragma-line-2977"></a>

***Part***\
&#x20;Allowed values are 'Time', 'Day', 'Hour', 'Minute', 'Second', 'Millisecond' and 'Tick'.\
&#x20;Type: String

***Value***\
&#x20;The value to add to the TimeSpan.\
&#x20;Type: Any

***TimeSpan***\
&#x20;The TimeSpan to alter.\
&#x20;Type: TimeSpan

#### Return Type <a href="#pragma-line-2992" id="pragma-line-2992"></a>

TimeSpan

## EndOfDateTime

Gets the DateTime representing the end of the given part of a given DateTime.

#### Syntax

```
EndOfDateTime ( DateTime , Part )
```

#### Parameters

**DateTime**\
&#x20;The DateTime to get the end of the given part from.\
&#x20;Type: DateTime

**Part**\
&#x20;Allowed values are 'Year', 'Quarter', 'Month', 'Week', 'Day', 'Hour', 'Minute', 'Second', 'Millisecond' and 'Tick' (case-insensitive, can be pluralized).\
&#x20;Type: String

#### Return type

DateTime

## Now

Represents the current date and time.

#### Syntax <a href="#pragma-line-3001" id="pragma-line-3001"></a>

```
Now (  )
```

#### Parameters <a href="#pragma-line-3007" id="pragma-line-3007"></a>

No parameters

#### Return Type <a href="#pragma-line-3011" id="pragma-line-3011"></a>

DateTime

## PartOfDateTime

Gets the given part of the given DateTime.

#### Syntax <a href="#pragma-line-3020" id="pragma-line-3020"></a>

```
PartOfDateTime ( Part , DateTime )
```

#### Parameters <a href="#pragma-line-3026" id="pragma-line-3026"></a>

***Part as String (required)***\
&#x20;Allowed values are 'Date', 'Time', 'Year', 'Quarter', 'Month', 'Day', 'Hour', 'Minute', 'Second', 'Millisecond' and 'Tick' (case-insensitive, can be pluralized).\
&#x20;Type: String

***DateTime***\
&#x20;The DateTime where to get the part from.\
&#x20;Type: DateTime

#### Return Type <a href="#pragma-line-3037" id="pragma-line-3037"></a>

Any

## PartOfTimeSpan

Deprecated: Use BeginOfDateTime with Part 'Month'.

Gets the given part of the given TimeSpan.

Gets the DateTime representing the beginning of the month of a given DateTime.

#### Syntax <a href="#pragma-line-3046" id="pragma-line-3046"></a>

```
PartOfTimeSpan ( Part , TimeSpan )
```

#### Parameters <a href="#pragma-line-3052" id="pragma-line-3052"></a>

***Part***\
&#x20;Allowed values are 'Day', 'TotalDay', 'Hour', 'TotalHour', 'Minute', 'TotalMinute', 'Second', 'TotalSecond', 'Millisecond', 'TotalMillisecond' and 'Tick'.\
&#x20;Type: String

***TimeSpan***\
&#x20;The TimeSpan where to get the part from.\
&#x20;Type: TimeSpan

#### Return Type <a href="#pragma-line-3063" id="pragma-line-3063"></a>

Any

Deprecated: Use EndOfDateTime with Part 'Month'.

Gets the DateTime representing the ending of the month of a given DateTime

## Deprecated!ToBeginOfMonth

#### Syntax <a href="#pragma-line-3072" id="pragma-line-3072"></a>

```
ToBeginOfMonth ( DateTime )
```

#### Parameters <a href="#pragma-line-3078" id="pragma-line-3078"></a>

***DateTime***\
&#x20;The DateTime to get the beginning of the month from.\
&#x20;Type: DateTime

#### Return Type <a href="#pragma-line-3085" id="pragma-line-3085"></a>

DateTime

## BeginOfDateTime

Gets the DateTime representing the beginning of the given part of a given DateTime.

#### Syntax <a href="#pragma-line-3094" id="pragma-line-3094"></a>

```
BeginOfDateTime ( DateTime , Part )
```

#### Parameters <a href="#pragma-line-3100" id="pragma-line-3100"></a>

***DateTime***\
&#x20;The DateTime to get the beginning of the given part from.

***Part as String (required)***\
&#x20;Allowed values are 'Year', 'Quarter', 'Month', 'Week', 'Day', 'Hour', 'Minute', 'Second' and 'Millisecond' (case-insensitive, can be pluralized).

#### Return Type <a href="#pragma-line-3107" id="pragma-line-3107"></a>

DateTime

## EndOfDateTime

Gets the DateTime representing the end of the given part of a given DateTime.

#### Syntax <a href="#pragma-line-3094" id="pragma-line-3094"></a>

```
EndOfDateTime ( DateTime , Part )
```

#### Parameters <a href="#pragma-line-3100" id="pragma-line-3100"></a>

***DateTime*** (required):\
&#x20;The DateTime to get the end of the given part from.\
&#x20;Type: DateTime

**Part** (required):\
&#x20;Allowed values are 'Year', 'Quarter', 'Month', 'Week', 'Day', 'Hour', 'Minute', 'Second', 'Millisecond' and 'Tick' (case-insensitive, can be pluralized).\
&#x20;Type: String

#### Return Type <a href="#pragma-line-3107" id="pragma-line-3107"></a>

DateTime
