+1 888 340 6572 



Post new topic Reply to topic 
Formating time, How to get proper result   [ ]
Author Message
#1 posted 06 Mar 2012 

Status: Offline
Posts: 1064
Thanks Received: 196 times
Thanks Given: 613 times
Joined: 23 Nov 2010
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:
String4 = formatTime("hh:mm:ss",eltimetodatetime(TempTime));

Any idea how I could get the proper value

Martin


#2 posted 06 Mar 2012 

Status: Offline
Posts: 1912
Thanks Received: 379 times
Thanks Given: 127 times
Joined: 21 Jul 2007
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



For this message the author bowlesj3 has received thanks:
arjfca


#3 posted 06 Mar 2012 

Status: Offline
Posts: 1064
Thanks Received: 196 times
Thanks Given: 613 times
Joined: 23 Nov 2010
Thanks John, I will recheck my code
Have a good evening

Martin



Post new topic Reply to topic