> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# GetTime()

## Definition

Returns the time stamp at the current bar index value.

This method will return what is displayed in the chart's data box. For formatting purposes, the value returned is NOT guaranteed to be equal to the **[TimeSeries](/developer/web-sdk/references/modules/timeseries)** value. If you are using daily bars and need the session end time, you should use **[Bars.GetSessionEndTime()](/developer/desktop-sdk/references/common/bars/getsessionendtime)** instead.

## Method Return Value

A DateTime structure that represents the time stamp at the desired bar index.

## Syntax

`Bars.GetTime(int index)`

## Parameters

| Parameter | Description                                     |
| --------- | ----------------------------------------------- |
| index     | An int representing an absolute bar index value |

## Examples

```csharp
protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
    base.OnRender(chartControl, chartScale);
    // loop through only the rendered bars on the chart
    for(int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++)
    {
        // get the time stamp at the selected bar index value
        DateTime timeValue = Bars.GetTime(barIndex);
        Print("Bar #" + barIndex + " time stamp is " + timeValue);
    }
}
```