> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# DateTimeElement

> DateTimeElement — CometChat documentation.

The DateTimeElement class is used to create a Date Picker element in a user interface.

### Properties

| Name           | Type                        | Description                                                 |
| -------------- | --------------------------- | ----------------------------------------------------------- |
| elementId      | `string`                    | This property in constructor accepts the Id for the element |
| label          | `string`                    | This property in constructor accepts the label for dropDown |
| mode           | UIKitConstants.DateTimeMode | It is the mode of the date time picker.                     |
| from           | `string`                    | It is the start date of the date time picker.               |
| to             | `string`                    | It is the end date of the date time picker.                 |
| timezoneCode   | `string`                    | It is the time zone of the given date.                      |
| dateTimeFormat | `string`                    | It is the format of the date time picker.                   |

### Class Usage

Here's an example of how you can create an instance of the DateTimeElement class:

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    DateTimeElement dateTimeElement = new DateTimeElement("21", "12-12-2024");
    dateTimeElement.setMode(UIKitConstants.DateTimeMode.DATE);
    dateTimeElement.setSimpleDateFormat(new SimpleDateFormat("dd-MM-yyyy"));
    dateTimeElement.setTimeZoneCode(TimeZone.getDefault().getID());
    ```
  </Tab>
</Tabs>

### Example

Here is an example that showcases the creation and manipulation of an instance of DateTimeElement:

<Tabs>
  <Tab title="Java">
    ```java theme={null}

    DateTimeElement dateTimeElement = new DateTimeElement("21", "12-12-2024");
    dateTimeElement.setMode(UIKitConstants.DateTimeMode.DATE);
    dateTimeElement.setSimpleDateFormat(new SimpleDateFormat("dd-MM-yyyy"));
    dateTimeElement.setTimeZoneCode(TimeZone.getDefault().getID());
    dateTimeElement.setFrom("12-01-2024");
    dateTimeElement.setTo("12-01-2025");
    ```
  </Tab>
</Tabs>
