# Dates manipulation

### Dates manipulation

#### toDate(localDateTime)

Obtain date type from string date representation with format YYYY-MM-DDThh:mm:ssTZD.

**Kind**: global function  
**Returns**: Date

| Param            | Type    | Description                                                                |
| ---------------- |---------| -------------------------------------------------------------------------- |
| localDateTime    | string  | Date string representation with format YYYY-MM-DDThh:mm:ssTZD.             |

Example of use:
```javascript
var date = toDate('2021-06-30T10:10:23.256Z');
```

#### getDailyResetDate()

Obtains date to reset daily counters.

This function returns date with current date, but with 00:00:00 hours.

**Kind**: global function  
**Returns**: Date

Example of use:
```javascript
var date = getDailyResetDate();
```

#### getDailyResetDateWithZuluHour(hour)

Obtains date to reset daily counters with defined hour in gmt+0.

**Kind**: global function  
**Returns**: Date

| Param            | Type    | Description                                                                |
| ---------------- |---------| -------------------------------------------------------------------------- |
| hour             | string  | Hour in format HH:mm:ss.                                                   |

Example of use:
```javascript
var date = getDailyResetDateWithZuluHour('02:00:00');
```

This function returns date with current date, but with 2:00:00 hours. For example, if current day is _2021-06-30_, the returned date in previously called function is _2021-06-30T02:00:00Z_


#### getMonthlyResetDate()

Obtains date to reset monthly counters.

This function returns date with first day of current month and 00:00:00 hours.

**Kind**: global function  
**Returns**: Date

Example of use:
```javascript
var date = getMonthlyResetDate();
```

#### getMonthlyResetDateWithZuluHour(hour)

Obtains date to reset monthly counters with defined hour in gmt+0.

**Kind**: global function  
**Returns**: Date

| Param            | Type    | Description                                                                |
| ---------------- |---------| -------------------------------------------------------------------------- |
| hour             | string  | Hour in format HH:mm:ss.                                                   |

```javascript
var date = getMonthlyResetDateWithZuluHour('02:00:00');
```

This function returns date with first day of current month, but with 2:00:00 hours. For example, if current day is _2021-06-30_, the returned date in previously called function is _2021-06-01T02:00:00Z_

#### getMonthlyResetDateWithZuluHourAndDayOfMonth(hour, dayOfMonth)

Obtains date to reset monthly counters with defined hour in gmt+0.

**Kind**: global function  
**Returns**: Date

| Param            | Type    | Description                                                                |
| ---------------- |---------| -------------------------------------------------------------------------- |
| hour             | string  | Hour in format HH:mm:ss.                                                   |
| dayOfMonth       | number  | Day of Month.                                                              |

```javascript
var date = getMonthlyResetDateWithZuluHourAndDayOfMonth('02:00:00', 21);
```

This function returns date of the day 21 of current month, but with 2:00:00 hours, when day of the month is null, then return first day of the month. For example, the returned date in previously called function is _2023-02-21T02:00:00Z_
