Cancel
Showing results for 
Search instead for 
Did you mean: 

Round up Time

Solution Partner Pioneer Solution Partner Pioneer
Solution Partner Pioneer

Hello guys!

 

I need to round up value of variable which is "Time" type. Is there any way to cut off the seconds or round it up to minutes?. (I just want to get Hours:Minutes)

 

Thank you !

3 REPLIES

Re: Round up Time

Phenom
Phenom

if it just is a matter of reformatting (s.b.)

 

is	

	s0,s :string;	
do
	
	s0 := to_str(eventcontroller.simtime);  -- exchange eventcontroller.simtime by individual time
	s := copy(s0,1,strlen(s0)-8);
	print s;
	
end;	

Betreff: Round up Time

Gears Phenom Gears Phenom
Gears Phenom

And if not, this

timeInMinutes := 60 * ceil(timeWithSec / 60)

should do the trick Smiley Happy

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!

Betreff: Round up Time

Solution Partner Pioneer Solution Partner Pioneer
Solution Partner Pioneer

Thanks to both of you, but I used that second advice Smiley Happy it works perfect, but I dont understand how it works, can you explain that code a little bit, so I can use it in future projects.

 

Thank you again !

Best regards.