Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9146

Re: Time Conversion into HH:MM:SS

$
0
0

hi Vishal,

 

hopefully you've posted all of the potential structures of the time stamp above...you can use this syntax below to convert.

 

note that the output is a timestamp, so you'll have to right click on your formula and choose Format Field > go to the Time tab > press Customize and ensure that you've got 24 Hour format and that Hour, Minute, Second are all set to "05" for double digit display.

 

stringvar t:= {your string field};

 

stringvar th; stringvar tm; stringvar sm;
numbervar hh; numbervar mm; numbervar ss;
stringvar array ta;

if instr(t, 'PT') > 0 then
    (
        t:= replace(t,'PT','');
        ta:= split(t,'M');
        if instr(t, 'M') > 0 and instr(t, 'S') > 0 then
            (        
                mm:= val(ta[1]);
                ss:= val(ta[2]);
            )
        else
        if instr(t, 'S') > 0 then
            (        
                ss:= val(ta[1]);
            )
    )
else
if instr(t, ':') > 0 then
    (
        ta:= split(t,':');
        numbervar u:= ubound(ta);
        if u = 3 then
            (        
                hh:= val(ta[1]);
                mm:= val(ta[2]);

                ss:= floor(val(ta[3]));

            )
    );

time(hh,mm,ss)


Viewing all articles
Browse latest Browse all 9146

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>