DateTime2ELTime_s (DateTime) VS Time_s

Questions about MultiCharts and user contributed studies.
tonyng
Posts: 51
Joined: 04 Oct 2013
Has thanked: 2 times
Been thanked: 5 times

DateTime2ELTime_s (DateTime) VS Time_s

Postby tonyng » 23 Jun 2014

Is there any real difference between the above 2 functions?

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: DateTime2ELTime_s (DateTime) VS Time_s

Postby JoshM » 24 Jun 2014

`Time_s` returns the time of the specified bar in HHmmss format. For example, 9:54:34 will be returned as 95434.

`DateTime2ELTime_s()` converts a DateTime format (which is a number that includes both the date and time) to PowerLanguage's HHmmss format.

For example:
* `ComputerDateTime` returns the DateTime of the computer.
* To get the current computer time in PowerLanguage PowerLanguage's HHmmss format, use `DateTime2ELTime_s(ComputerDateTime)`.

Why is DateTime needed?
When performing calculations PowerLanguage's HHmmss will first need to be transformed to DateTime, otherwise you'd get faulty results. For example, subtracting 6 hours (60000) from 2:30:31 (HHmmss format of 23031) gives -36969, which is not a real time.


Return to “MultiCharts”