# danog\MadelineProto\EventHandler\Message\Rich\Text\Date: A date, shown in the local time zone of the user, in the specified format.

[Back to index](../../../../../../index.html)

> Author: Daniil Gentili <daniil@daniil.it>  
  

A date, shown in the local time zone of the user, in the specified format.  



## Properties
* `$text`: `danog\MadelineProto\EventHandler\Message\Rich\RichText` Text shown by clients that don't support dates
* `$date`: `int` Unix timestamp of the date
* `$relative`: `bool` Whether to show the date relative to the current time (e.g. "in 5 minutes"), ignoring the other flags
* `$shortTime`: `bool` Whether to show the time in short format (e.g. 22:45)
* `$longTime`: `bool` Whether to show the time in long format (e.g. 22:45:00)
* `$shortDate`: `bool` Whether to show the date in short format (e.g. 17.03.22)
* `$longDate`: `bool` Whether to show the date in long format (e.g. March 17, 2022)
* `$dayOfWeek`: `bool` Whether to show the day of the week

## Method list:
* [`__construct(\danog\MadelineProto\EventHandler\Message\Rich\RichText|string $text, int $date, bool $relative = false, bool $shortTime = false, bool $longTime = false, bool $shortDate = false, bool $longDate = false, bool $dayOfWeek = false)`](#__construct)
* [`from(\danog\MadelineProto\EventHandler\Message\Rich\RichText|string $text): \danog\MadelineProto\EventHandler\Message\Rich\RichText`](#from)
* [`getText(): string`](#getText)
* [`getEntities(): list<\danog\MadelineProto\EventHandler\Message\Entities\MessageEntity>`](#getEntities)
* [`getHTML(bool $allowTelegramTags = false): string`](#getHTML)

## Methods:
### <a name="__construct"></a> `__construct(\danog\MadelineProto\EventHandler\Message\Rich\RichText|string $text, int $date, bool $relative = false, bool $shortTime = false, bool $longTime = false, bool $shortDate = false, bool $longDate = false, bool $dayOfWeek = false)`




Parameters:

* `$text`: `\danog\MadelineProto\EventHandler\Message\Rich\RichText|string`   
* `$date`: `int`   
* `$relative`: `bool`   
* `$shortTime`: `bool`   
* `$longTime`: `bool`   
* `$shortDate`: `bool`   
* `$longDate`: `bool`   
* `$dayOfWeek`: `bool`   


#### See also: 
* [`\danog\MadelineProto\EventHandler\Message\Rich\RichText`: Styled text of a [rich message](https://core.telegram.org/bots/api#richtext): a tree of plain texts, styles, links and so on.](../../../../../../danog/MadelineProto/EventHandler/Message/Rich/RichText.html)




### <a name="from"></a> `from(\danog\MadelineProto\EventHandler\Message\Rich\RichText|string $text): \danog\MadelineProto\EventHandler\Message\Rich\RichText`

Get a rich text from a rich text or a plain string.


Parameters:

* `$text`: `\danog\MadelineProto\EventHandler\Message\Rich\RichText|string`   



### <a name="getText"></a> `getText(): string`

Get the plain text version of the rich text.



### <a name="getEntities"></a> `getEntities(): list<\danog\MadelineProto\EventHandler\Message\Entities\MessageEntity>`

Get the [entities](https://core.telegram.org/api/entities) for the styles of the plain text version of the rich text.


#### See also: 
* [`\danog\MadelineProto\EventHandler\Message\Entities\MessageEntity`: Master class for message entities.](../../../../../../danog/MadelineProto/EventHandler/Message/Entities/MessageEntity.html)




### <a name="getHTML"></a> `getHTML(bool $allowTelegramTags = false): string`

Get an HTML version of the rich text.


Parameters:

* `$allowTelegramTags`: `bool` Whether to allow telegram-specific tags like tg-spoiler, tg-emoji, mention links and so on...  



---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
