龙听期货论坛's Archiver

龙听 发表于 2022-11-2 14:31

【ELTimeToString】

[code][LegacyColorValue = true];
{ ELTimeToString Function}
{ This function accepts a EL time and returns the date string HH:MM }
{ Written by eKam 8/ 2/2003 }
{ TimeToStr, a different version, was also coded by Greg Ballard, 2004}       
{ Bug fix    eKam 4/27/2004 }

inputs: TimeSelect( numericsimple );
var: s(""),strl(0);
s = NumToStr(TimeSelect,0);
strl = strlen(s);
if      strl = 4 then
        ELTimeToString =       LeftStr(s,2) + ":" + RightStr(s,2)
else if strl = 3 then
        ELTimeToString = "0" + LeftStr(s,1) + ":" + RightStr(s,2)
else if strl = 2 then
        ELTimeToString = "00:" + RightStr(s,2)
else if strl = 1 then
        ELTimeToString = "00:0" + RightStr(s,1)
else if strl = 0 then
        ELTimeToString = "00:00";

[/code]

页: [1]