Formating time, How to get proper result

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1200
Joined: 23 Nov 2010
Has thanked: 699 times
Been thanked: 218 times

Formating time, How to get proper result

Postby arjfca » 06 Mar 2012

Hello

I need to format a variable time value like ("HH:MM:SS")

The variable contain result of a calculation and is value are in an Eltime format like (HHMMSS)

Problem is the variable does not show the leading 0

EX: Temptime = 155 //= hh:mm:ss = 00:01:55

Problem is the code recognize 155 as 01:55:00

Code: Select all

String4 = formatTime("hh:mm:ss",eltimetodatetime(TempTime));

Any idea how I could get the proper value

Martin

bowlesj3
Posts: 1915
Joined: 21 Jul 2007
Has thanked: 128 times
Been thanked: 388 times

Re: Formating time, How to get proper result

Postby bowlesj3 » 06 Mar 2012

Hi arjfca.

I am not totally sure I understand your question but maybe these will help.
Upon reading your question again I noticed you do not have the _s at the end of your command ELTimeToDateTime. Maybe adding the _s will fix it. All my examples have it as ELTimeToDateTime_s rather than ELTimeToDateTime.

according to the help you need the HH as in this "HH:mm:ss"


I did a search throughout my code and found these statements which I extracted.
Based upon the if statement, it appears you should get the 00 format for hours minutes and seconds.

strDate = FormatDate("yyyy/MMM/dd",ComputerDateTime);
strTime = FormatTime("HH:mm:ss",ComputerDateTime);

strTime = FormatTime("HH:mm",ComputerDateTime);

if formattime("HH",ELTimeToDateTime_s(Time_s)) > "00"
and formattime("mm",ELTimeToDateTime_s(Time_s)) = "00"
and formattime("ss",ELTimeToDateTime_s(Time_s)) = "00" then
These users thanked the author bowlesj3 for the post:
arjfca

arjfca
Posts: 1200
Joined: 23 Nov 2010
Has thanked: 699 times
Been thanked: 218 times

Re: Formating time, How to get proper result

Postby arjfca » 06 Mar 2012

Thanks John, I will recheck my code
Have a good evening

Martin


Return to “MultiCharts”