---
id: "M:cAlgo.API.ChartArea.XToTime(System.Double)"
kind: "method"
type: "T:cAlgo.API.ChartArea"
url: "https://help.ctrader.com/ctrader-algo/references/Chart/ChartArea/XToTime/"
---

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

# ChartArea.XToTime

Member of [ChartArea](https://help.ctrader.com/ctrader-algo/references/Chart/ChartArea/index.md).

## XToTime(double x)

Converts Mouse X coordinate to area Time coordinate value.

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

- CLI: Always returns DateTime.MinValue; no conversion is done.
- Cloud: Always returns DateTime.MinValue; no conversion is done.

C#:

```csharp
DateTime XToTime(double x)
```

Python:

```python
chartArea.XToTime(x: float) -> DateTime
```

### Parameters

- `x` (`double`, Python `float`): Mouse X

### Returns

`DateTime` — Time

### Examples

C#:

```csharp
var timeAtCenter = Chart.XToTime(Chart.Width / 2);
Print("Time at the chart center: {0}", timeAtCenter);
```

Python:

```python
timeAtCenter = api.Chart.XToTime(api.Chart.Width / 2)
api.Print(f"Time at the chart center: {timeAtCenter}")
```

