# DATETIME

\*\*The function DATETIME combines the information contained in a given Date, Time, and timezone (represented in a string) into a single DateTime. \*\*

This function takes three pieces of input: a [Date](../../variable-data-types/the-date-variable-data-type), a [Time](../../variable-data-types/the-time-variable-data-type), and a [string](../../variable-data-types/the-text-variable-data-type) (describing a timezone according to its [TZ database name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)). It returns a single [DateTime](../../variable-data-types/the-datetime-variable-data-type), containing all information represented by the input.

#### Declaration

```javascript
DATETIME(date, time, time_zone) -> datetime
```

&#x20;

#### Parameters

**date** (required, type: _Date_) Any Date.

**time** (required, type: _Time_) Any Time.

**time\_zone** (optional, type: _string,_ default: "UTC") A string containing a timezone. Timezones must be described by their [TZ database names](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).

#### Return Values

**datetime** (type: _DateTime_) A DateTime containing the information given by **date**, **time**, and **time\_zone**.

#### Examples

Assuming the following examples have access to the following Date and Time values:

```javascript
example_date = {  
 "day": 16  
 "month": 4  
 "year": 2021  
}  
  
example_time = {  
 "hour": 13  
 "minute": 26  
 "second": 32  
 "millisecond": 0  
}
```

The following example takes the date described by **example\_date** and the time described by **example\_time** and creates a single DateTime with the information contained in both. Note that no timezone was specified, so the timezone of the created DateTime defaults to "UTC":

```javascript
DATETIME(example_date, example_time) ->{  
 "date": {  
  "day": 16,  
  "month": 4,  
  "year": 2021  
 },  
 "time": {  
  "hour": 13,  
  "minute": 26,  
  "second": 32,  
  "millisecond": 0  
 },  
 "timeZone": "UTC"  
}
```

The following example is given the same Date and Time values as the example above, but the timezone is defined, not as "UTC", but as "Africa/Dar\_es\_Salaam". Note that this timezone is three hours ahead of UTC, but this does not impact the time information in the returned DateTime; the hour, minute, second, and millisecond values all correspond with their analogous values in **example\_time**. The DATETIME function assumes the given time information is in the relevant timezone:

```javascript
DATETIME(example_date, example_time, "Africa/Dar_es_Salaam") ->{  
 "date": {  
  "day": 16,  
  "month": 4,  
  "year": 2021  
 },  
 "time": {  
  "hour": 13,  
  "minute": 26,  
  "second": 32,  
  "millisecond": 0  
 },  
 "timeZone": "Africa/Dar_es_Salaam"  
}
```
