# Decimal To Time

Hello, is there any way to convert a decimal into time?
For example if I have 367000 how do I handle the controls in time like 60minutes and 24hours?

local procedure DecimalToTime(DecimalP: Decimal) Result: Time
var
DecStr: Text;
begin
DecStr := Format(DecimalP);
DecStr := DelChr(DecStr, ‘=’, ‘.’);
Evaluate(Result, DecStr);
end;

Yes, it is possible to convert a decimal value into time in Business Central. In order to do this, you can create a local procedure that takes the decimal value as a parameter and returns the time value. Here is an example of how you can achieve this:

local procedure DecimalToTime(DecimalP: Decimal) Result: Time
var
Hours: Integer;
Minutes: Integer;
Seconds: Integer;
TimeStr: Text;
begin
// Convert the decimal value into hours, minutes, and seconds
Hours := Integer(DecimalP / 3600);
Minutes := Integer((DecimalP - (Hours * 3600)) / 60);
Seconds := Integer(DecimalP - (Hours * 3600) - (Minutes * 60));

``````// Format the time string as HH:MM:SS
TimeStr := Format('%1:%2:%3', Hours, Minutes, Seconds);

// Convert the time string into a time value
Evaluate(Result, TimeStr);
``````

end;

You can then call this local procedure and pass in the decimal value you want to convert as follows:

TimeValue := DecimalToTime(367000);

TimeValue := DecimalToTime(367000);

This will return a time value of 01:01:40, which corresponds to 367000 seconds (60 minutes + 1 hour).