# datetime difference between two points

656

If I have two points with two different times can I know the time difference in minutes?

Moderator
2322

Subtract one time from the other. That is the difference in seconds.

Divide by 60 to get the difference in minutes.

656

`I can take the time from an indicator simply by declaring it the code:`
```
```
```double time1= icustom ()
double time2= icustom ()

(time1-time2) /60
```
16086

1. ICustom returns buffer values. Not time.
2. If you know the two indexes, you know the times (Time[i])
656

thanks for the answers, give me a tremendous help. But I have a doubt, I use:

`iTime (Symbol(), PERIOD_CURRENT,i)`

but do not understand how to take the time on:

`iCustom(Symbol(), PERIOD_CURRENT, "::Indicators\\myindicator.ex4", 0, i)`

16086

1. iTime(Symbol(), PERIOD_CURRENT, i) is the same as Time[i].
2. There is no time with iCustom. You have the "i" use Time[i].
656

Ok thanks WHRoeder, a small step understand the code. With this formula, I should have found the solution

`double A= (Time[1+i] - Time[2+i]) /60; //Minutes between Candle1 and Candle2`

Correct?!?

But I still have a problem, I can not understand how to read a time of an out buffer, with Time[i]

Moderator
10617

fly7680:

But I still have a problem, I can not understand how to read a time of an out buffer, with Time[i]