Support Board
Date/Time: Tue, 11 Feb 2025 14:08:17 +0000
[User Discussion] - Convert HMS to MInutes
View Count: 854
[2020-09-13 11:03:52] |
Graham - Posts: 44 |
Struggling to work this out using the SDDateTime() functionality. How can I convert the total time in HMS to just minutes. SCDateTime can extract any part of the time but I need to convert a variable that could be HMS or just MS to Minutes only. As an example, if the variable returns 01:56:00 (HMS) what would the code be to convert that to Minutes only, resulting in: 116. Thanks in advance. |
[2020-09-13 12:34:46] |
User907968 - Posts: 826 |
If you already have an SCDateTime variable, for minutes you could use GetTimeInSeconds() / 60 Working with the SCDateTime Variables and Values: GetTimeInSeconds() int Minutes = dateTime.GetTimeInSeconds() / 60;
If you first need to construct the SCDateTime variable from HMS (or just MS) you could use the appropriate constructor. Working with the SCDateTime Variables and Values: SCDateTime() Constructors SCDateTime(int Hour, int Minute, int Second, int Millisecond); SCDateTime dateTime(H, M, S, 0);
|
To post a message in this thread, you need to log in with your Sierra Chart account: