Your question, your audience. Choose who sees your identityâ€”and your questionâ€”with question security.

Hoi,

I have make somthing, but it wont work correcly.

Please help my

inttotimestr(2123333) = result 73d 05:43:04:53 ????????

function inttotimestr(S: integer): string; // z.B. 3600-> '01:00:00'

var

st:string;

ti,t:integer;

begin

try

st:='';

if (s > 28800) then begin

st:=inttostr(s div 28800)+'d ';

end;

s:=s mod 28800;

if (s div 480) = 0 then

st:=st+'00:'

else if (s div 480) < 10 then

st:=st+'0'+inttostr(s div 480)+':'

else

st:=st+inttostr(s div 480)+':';

ti:=s mod 480;

if (ti div 60) = 0 then

st:=st+'00:'

else if (ti div 60) < 10 then

st:=st+'0'+inttostr(ti div 60)+':'

else

st:=st+inttostr(ti div 60)+':';

t:=ti mod 60;

if t = 0 then

st:=st+'00'

else if t < 10 then

st:=st+'0'+inttostr(t)

else

st:=st+inttostr(t);

except

st:='00:00:00';

end;

inttotimestr:=st;

end;

I have make somthing, but it wont work correcly.

Please help my

inttotimestr(2123333) = result 73d 05:43:04:53 ????????

function inttotimestr(S: integer): string; // z.B. 3600-> '01:00:00'

var

st:string;

ti,t:integer;

begin

try

st:='';

if (s > 28800) then begin

st:=inttostr(s div 28800)+'d ';

end;

s:=s mod 28800;

if (s div 480) = 0 then

st:=st+'00:'

else if (s div 480) < 10 then

st:=st+'0'+inttostr(s div 480)+':'

else

st:=st+inttostr(s div 480)+':';

ti:=s mod 480;

if (ti div 60) = 0 then

st:=st+'00:'

else if (ti div 60) < 10 then

st:=st+'0'+inttostr(ti div 60)+':'

else

st:=st+inttostr(ti div 60)+':';

t:=ti mod 60;

if t = 0 then

st:=st+'00'

else if t < 10 then

st:=st+'0'+inttostr(t)

else

st:=st+inttostr(t);

except

st:='00:00:00';

end;

inttotimestr:=st;

end;

here is a routine I made, because I just can't make out what you want to do. This will convert a number of minutes, to week,day, hour, minute, considering that 1 week has 5 days, 1 day has 8 hours and 1 hour has 60 seconds.

function inttotimestr(s:integer):st

var w,d,h,m:word;

begin

w:=s div (5*8*60);// 5 days with 8 hours having 60 min

s:=s mod (5*8*60);

d:=s div (8*60);

s:=s mod (8*60);

h:=s div 60;

m:=s mod 60;

result:=format('%d:%.2d:%.

end;

Regards,

Russell

function MinutesToWorkTime(Minutes:

var dwTime: Array [0..4] of Integer;

dwCurrent: Integer;

begin

// Calculate weeks

dwTime[0]:=Minutes div 144000;

dwCurrent:=Minutes mod 144000;

// Calculate days

dwTime[1]:=dwCurrent div 28800;

dwCurrent:=dwCurrent mod 28800;

// Calculate hours

dwTime[2]:=dwCurrent div 3600;

dwCurrent:=dwCurrent mod 3600;

// Calculate minutes

dwTime[3]:=dwCurrent div 60;

dwCurrent:=dwCurrent mod 60;

// Calculate seconds

dwTime[4]:=dwCurrent;

// Set result

SetLength(result, 0);

// Build string with weeks and days

if (dwTime[0] > 0) then result:=IntToStr(dwTime[0]

if (dwTime[1] > 0) then

begin

if (Length(result) > 0) then

result:=result+' '+IntToStr(dwTime[1])+'d'

else

result:=result+' '+IntToStr(dwTime[1])+'d';

end;

// Add remaining hours:minutes:seconds

if (Length(result) > 0) then

result:=result+Format(' %.2d:%.2d:%.2d', [dwTime[2], dwTime[3], dwTime[4]])

else

result:=result+Format('%.2

end;

I have test our solutions. i see the

By great number workt it. (great !)

test 1 example result 2123333 min = 14w 3d 05:48:53

test 2 example result 810 min = 00:13:30 ??? must by 1d:05:30:00

test 3 example result 510 min = 00:08:30 ist OK ?

it wont work correcly with small numbers ?

if you are inputting minutes, how are you getting non-zero seconds?

I adapted my code to seconds input and indeed now I am getting your desired results. so you don't inputmin, you input seconds.

regarding your "small numbers"

810 seconds are 13 min and 30 seconds not 1 day 5 hours and 30 min

function inttotimestr(s:integer):st

var w,d,h,m,se:word;

begin

w:=s div (5*8*60*60);// 5 days with 8 hours having 60 min

s:=s mod (5*8*60*60);

d:=s div (8*60*60);

s:=s mod (8*60*60);

h:=s div (60*60);

s:=s mod (60*60);

m:=s div 60;

se:=s mod 60;

result:=format('%d:%.2d:%.

end;

function inttotimestr(s:integer):st

var w,d,h,m,se:word;

begin

w:=s div (5*8*60*60);// 5 days with 8 hours having 60 min

s:=s mod (5*8*60*60);

d:=s div (8*60*60);

s:=s mod (8*60*60);

h:=s div (60*60);

s:=s mod (60*60);

m:=s div 60;

se:=s mod 60;

result:=format('%dw %dd %.2d:%.2d:%.2d',[w,d,h,m,s

end;

MinuteOf

MinuteOfTheDay

MinuteOfTheHour

MinuteOfTheMonth

MinuteOfTheWeek

MinuteOfTheYear

MinutesBetween

MinuteSpan

so B is more than enough :P

a little sarcastic this morning :D

i'm in a good mood, though I have a papre due in 30 minutes and it's ... far from ready. and instead of working on that, I am writing this. totally illogical.

oh well, back to my paper :)

now ... we have an integer as input... so the usage is a little tricky.

btw, I have woken up for quite some hours, but I can't figure out what are the congratulations for.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.

:)