# Date

{% hint style="danger" %}
**Please note:** This page is under construction and has not been finished yet.
{% endhint %}

## Introduction

```php
$gen = e107::getDate();
```

## Date methods

### computeLapse()

Calculate difference between two dates for display in terms of years/months/weeks....

```php
$gen->computeLapse($older_date, $newer_date = FALSE, $mode = FALSE, $show_secs = TRUE, $format = 'long') 
```

| Parameter       | Type    | Description                                                                                                                          | Mandatory? |
| --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------ | ---------- |
| **older\_date** | integer | UNIX timestamp                                                                                                                       | **Yes**    |
| newer\_date     | integer | <p>UNIX timestamp</p><p><em>Default:</em> current time</p>                                                                           | No         |
| mode            | boolean | <p>if <em>true</em> return value is an array. Otherwise return value is a string</p><p><em>Default: false</em></p>                   | No         |
| show\_secs      | boolean | *Default: true*                                                                                                                      | No         |
| format          | string  | <p>Format of the human readable date. Options:</p><ul><li>long</li><li>short (omits the year)</li></ul><p><em>Default: long</em></p> | No         |

### convert\_date()

Convert datestamp to human readable date. System time offset is considered.

```php
$gen->convert_date($datestamp, $mask = '')
```

| Parameter | Type    | Description                                                                                                                                                                                                                                                                                                                                    | Mandatory? |
| --------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| datestamp | integer | UNIX timestamp                                                                                                                                                                                                                                                                                                                                 | **Yes**    |
| mask      | string  | <p>Format of the human readable date. Options:</p><ul><li>long</li><li>short</li><li>forum</li><li>relative</li><li>(any <span data-gb-custom-inline data-tag="emoji" data-code="1f449">👉</span><a href="https://www.php.net/manual/en/function.strftime.php"><code>strftime()</code></a>valid string)</li></ul><p><em>Default: long</em></p> | No         |

{% hint style="info" %}
The configuration of the *mask* formats are specified in :point\_right: Admin Area > Preferences > [Date Display options](https://userguide.e107.org/administration/settings/preferences#date-display-options).&#x20;
{% endhint %}

### terms()

Return an array of language terms representing months

```php
$gen->terms($type='month')
```

| Parameter | Type   | Description                                                                                                                                                                                                                  | Mandatory? |
| --------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| type      | string | <p>Options:</p><ul><li>month <em>(August)</em></li><li>month-short <em>(Aug)</em></li><li>day <em>(Tuesday)</em></li><li>day-short <em>(Tue)</em></li><li>day-shortest <em>(Tu)</em></li></ul><p><em>Default:</em> month</p> | **Yes**    |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devguide.e107.org/classes-and-methods/date.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
