Hi,
I have this variable and it returns 1400 for example. Wanting to format it to 14:00:00.
var3( Time ),
This doesn't work, returns 12:00:00 all the time.
";", FormatTime("hh:mm:ss",var3)
Thanks in advance.
Format time [SOLVED]
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: Format time [SOLVED]
try this:Hi,
I have this variable and it returns 1400 for example. Wanting to format it to 14:00:00.
var3( Time ),
This doesn't work, returns 12:00:00 all the time.
";", FormatTime("hh:mm:ss",var3)
Thanks in advance.
Code: Select all
Time$ = FormatTime ( "hh:mm:ss" , ELTimeToDateTime ( time ) ) ;
Re: Format time
Spoke to soon...
Times before 1PM work.
12:50:00 = 12:50:00
Times after though it looks like this.
15:15:00 = 3:15:00
In code: var3 is where I would like the time, hh:mm:ss.
outputString = Text(FormatDate("MM-dd-yyyy", ELDateToDateTime(var2) ), ";", var3,
";", NumToStr(var1, 4));
Times before 1PM work.
12:50:00 = 12:50:00
Times after though it looks like this.
15:15:00 = 3:15:00
In code: var3 is where I would like the time, hh:mm:ss.
outputString = Text(FormatDate("MM-dd-yyyy", ELDateToDateTime(var2) ), ";", var3,
";", NumToStr(var1, 4));
Code: Select all
inputs:
Price( Close ),
RetracePct( 5 ),
LineColor( Yellow ),
LineWidth( 1 ) ;
variables:
var0( 0 ),
var1( Price ),
var2( Date ),
var3( Time ),
var4( 0 ),
var5( 1 + RetracePct * .01 ),
var6( 1 - RetracePct * .01 ),
var7( false ),
var8( false ),
var9( false ),
var10( 0 ) ;
Variables:
outputString(""),
printLastValueOnce(false);
var0 = SwingHigh( 1, Price, 1, 2 ) ;
if var0 <> -1 then
begin
condition1 = var4 <= 0 and var0 >= var1 * var5 ;
if condition1 then
begin
var7 = true ;
var8 = true ;
var4 = 1 ;
end
else
begin
condition1 = var4 = 1 and var0 >= var1 ;
if condition1 then
begin
var7 = true ;
var9 = true ;
end ;
end;
end
else
begin
var0 = SwingLow( 1, Price, 1, 2 ) ;
if var0 <> -1 then
begin
condition1 = var4 >= 0 and var0 <= var1 * var6 ;
if condition1 then
begin
var7 = true ;
var8 = true ;
var4 = -1 ;
end
else
begin
condition1 = var4 = -1 and var0 <= var1 ;
if condition1 then
begin
var7 = true;
var9 = true ;
end ;
end;
end ;
end ;
// Generate data string and output to file
if (var8 = true) or (LastBarOnChart_s = true and printLastValueOnce = false) then begin
once ClearDebug;
outputString = Text(FormatDate("MM-dd-yyyy", ELDateToDateTime(var2) ), ";", var3,
";", NumToStr(var1, 4));
Print(outputString);
FileAppend("C:\ZigZag_Delete_First_Data_Will_Append.csv", Text(outputString, NewLine));
if (LastBarOnChart_s = true) then
printLastValueOnce = true;
end;
if var7 then
begin
var1 = var0 ;
var2 = Date[1] ;
var3 = Time[1] ;
var7 = false ;
end ;
if var8 then
begin
var10 = TL_New( var2, var3, var1, var2[1], var3[1],
var1[1] ) ;
TL_SetExtLeft( var10, false ) ;
TL_SetExtRight( var10, false ) ;
TL_SetSize( var10, LineWidth ) ;
TL_SetColor( var10, LineColor ) ;
var8 = false ;
end
else if var9 then
begin
TL_SetEnd( var10, var2, var3, var1 ) ;
var9 = false ;
end ;
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: Format time
Try this:Spoke to soon...
Times before 1PM work.
12:50:00 = 12:50:00
Times after though it looks like this.
15:15:00 = 3:15:00
Code: Select all
Time$ = FormatTime ( "HH:mm:ss" , ELTimeToDateTime ( time ) ) ;