To create the string i use
Code: Select all
TimeExitStr =text(Time));
I want to format my string to be a "0" instead of the (space)
Result should be (09:45:12)
Any idea how I could achieved that?
Martin
Code: Select all
TimeExitStr =text(Time));
I could not replicate your "12:00:00"-problem, but did had wrong values using your code (see below). To summarize, use EL_TimeToDateTime_s(Time_s) as input for the FormatTime() function.Thanks
I just found the function FormatTime("hh:mm:ss", atime);
My time is (Time) that is the value of the ending time of a bar
The return string value for
FormatTime("hh:mm:ss", time) is "12:00:00" for every time (ending bar time) value
If i could have this function to work, it should resolve my problem
Martin
Code: Select all
once cleardebug;
if CurrentBar > 500 and CurrentBar < 550 then begin
Print("Time of bar: ", time, NewLine,
Spaces(2), "With FormatTime(time): ", FormatTime("HH:mm:ss", time),
Spaces(2), "With FormatTime(time) with EL_TimeToTimeDate: ", FormatTime("HH:mm:ss", EL_TimeToDateTime(time)));
Print(Spaces(3), "With Time_s of bar: ", time_s, " formatTime: ", FormatTime("HH:mm:ss", ELTimeToDateTime_s(time_s)),
NewLine);
end;
Code: Select all
Time of bar: 1004.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:04:00
With Time_s of bar: 100412.00 formatTime: 10:04:12
Time of bar: 1005.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:05:00
With Time_s of bar: 100537.00 formatTime: 10:05:37
Time of bar: 1006.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:06:00
With Time_s of bar: 100621.00 formatTime: 10:06:21
Time of bar: 1009.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:09:00
With Time_s of bar: 100917.00 formatTime: 10:09:17
Time of bar: 1012.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:12:00
With Time_s of bar: 101201.00 formatTime: 10:12:01
Time of bar: 1013.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:13:00
With Time_s of bar: 101346.00 formatTime: 10:13:46
Time of bar: 1016.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:16:00
With Time_s of bar: 101610.00 formatTime: 10:16:10
Time of bar: 1018.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:18:00
With Time_s of bar: 101830.00 formatTime: 10:18:30
Time of bar: 1020.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:20:00
With Time_s of bar: 102053.00 formatTime: 10:20:53
Time of bar: 1022.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:22:00
With Time_s of bar: 102231.00 formatTime: 10:22:31
Time of bar: 1023.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:23:00
With Time_s of bar: 102355.00 formatTime: 10:23:55
Time of bar: 1025.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:25:00
With Time_s of bar: 102525.00 formatTime: 10:25:25
Time of bar: 1025.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:25:00
With Time_s of bar: 102557.00 formatTime: 10:25:57
Time of bar: 1028.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:28:00
With Time_s of bar: 102810.00 formatTime: 10:28:10
Time of bar: 1034.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:34:00
With Time_s of bar: 103401.00 formatTime: 10:34:01
Time of bar: 1036.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:36:00
With Time_s of bar: 103633.00 formatTime: 10:36:33
Time of bar: 1038.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:38:00
With Time_s of bar: 103815.00 formatTime: 10:38:15
Time of bar: 1044.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:44:00
With Time_s of bar: 104435.00 formatTime: 10:44:35
Time of bar: 1044.00
With FormatTime(time): 00:00:00 With FormatTime(time) with EL_TimeToTimeDate: 10:44:00
With Time_s of bar: 104444.00 formatTime: 10:44:44