---
id: "T:cAlgo.API.DateTimePicker"
kind: "class"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Controls/DateTimePicker/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# DateTimePicker (class)

Represents the date time picker control.

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Accepted without error but never displayed, so control events such as Click are never raised.
- Cloud: Accepted without error but never displayed, so control events such as Click are never raised.

## Definition

```csharp
public class DateTimePicker : ControlBase
```

Available since cAlgo.API 5.5.

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo.Robots;

public partial class TestExample : Robot
{
   protected override void OnStart()
   {
       var dateTimePicker = new DateTimePicker
       {
            Value = Server.Time,
            MaxValue = Server.Time.AddMonths(1),
            MinValue = Server.Time.AddMonths(-1)
       };

       dateTimePicker.ValueChanged += args => Print($"Date Time Picker value change to: {args.NewValue}");

       var changeValueButton = new Button {Text = "Change Value"};

       changeValueButton.Click += args => dateTimePicker.Value = Server.Time.AddDays(1);

       var panel = new StackPanel
       {
            Orientation = Orientation.Vertical,
            HorizontalAlignment = HorizontalAlignment.Center,
            VerticalAlignment = VerticalAlignment.Center
       };

       panel.AddChild(dateTimePicker);
       panel.AddChild(changeValueButton);

       Chart.AddControl(panel);
   }
}
```

Python:

```python
import clr

clr.AddReference("cAlgo.API")

# Import cAlgo API types
from cAlgo.API import *
# Import trading wrapper functions
from robot_wrapper import *

class Test():
    def on_start(self):
        self.dateTimePicker = DateTimePicker()
        self.dateTimePicker.Value = api.Server.Time
        self.dateTimePicker.MaxValue = api.Server.Time.AddMonths(1)
        self.dateTimePicker.MinValue = api.Server.Time.AddMonths(-1)

        self.dateTimePicker.ValueChanged += lambda args: api.Print(f"Date Time Picker value change to: {args.NewValue}")

        changeValueButton = Button()
        changeValueButton.Text = "Change Value"
        changeValueButton.Click += self.on_change_value_button_clicked

        panel = StackPanel()
        panel.Orientation = Orientation.Vertical
        panel.HorizontalAlignment = HorizontalAlignment.Center
        panel.VerticalAlignment = VerticalAlignment.Center

        panel.AddChild(self.dateTimePicker)
        panel.AddChild(changeValueButton)

        api.Chart.AddControl(panel)

    def on_change_value_button_clicked(self, args):
        self.dateTimePicker.Value = api.Server.Time.AddDays(1)
```

config.json:

```json
{
  "AccessRights": "None"
}
```

## Constructors

- `public DateTimePicker()` — Initializes a new instance of the DateTimePicker class. [details](https://help.ctrader.com/ctrader-algo/references/Controls/DateTimePicker/Constructor/index.md)

## Properties

- `public DateTime MaxValue {get; set;}` — Gets or sets maximum value. [details](https://help.ctrader.com/ctrader-algo/references/Controls/DateTimePicker/MaxValue/index.md)
- `public DateTime MinValue {get; set;}` — Gets or sets minimum value. [details](https://help.ctrader.com/ctrader-algo/references/Controls/DateTimePicker/MinValue/index.md)
- `public bool ShowTimeInput {get; set;}` — Gets or sets whether show time picker input or not. [details](https://help.ctrader.com/ctrader-algo/references/Controls/DateTimePicker/ShowTimeInput/index.md)
- `public DateTime Value {get; set;}` — Gets or sets value. [details](https://help.ctrader.com/ctrader-algo/references/Controls/DateTimePicker/Value/index.md)

## Events

- `public event Action<DateTimePickerValueChangedEventArgs> ValueChanged;` — Occurs when value is changed. [details](https://help.ctrader.com/ctrader-algo/references/Controls/DateTimePicker/ValueChanged/index.md)

## Inherited members

- `public void ResetProperty(ControlProperty property)` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/ResetProperty/index.md)
- `public Guid UniqueId {get;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/UniqueId/index.md)
- `public Style Style {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Style/index.md)
- `public double Left {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Left/index.md)
- `public double Top {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Top/index.md)
- `public double Right {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Right/index.md)
- `public double Bottom {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Bottom/index.md)
- `public double Width {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Width/index.md)
- `public double Height {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Height/index.md)
- `public double MinWidth {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MinWidth/index.md)
- `public double MinHeight {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MinHeight/index.md)
- `public double MaxWidth {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MaxWidth/index.md)
- `public double MaxHeight {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MaxHeight/index.md)
- `public bool IsEnabled {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/IsEnabled/index.md)
- `public bool IsVisible {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/IsVisible/index.md)
- `public double Opacity {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Opacity/index.md)
- `public Thickness Margin {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Margin/index.md)
- `public VerticalAlignment VerticalAlignment {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/VerticalAlignment/index.md)
- `public HorizontalAlignment HorizontalAlignment {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/HorizontalAlignment/index.md)
- `public Dock Dock {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Dock/index.md)
- `public bool IsHitTestVisible {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/IsHitTestVisible/index.md)

