Formatting Decimals in floats

I have a float that represents the players times. I used this command to truncate it, so it doesn’t have a bunch of decimals.

lastTime = Mathf.Round(lastTime * 1000f) / 1000f;

but if the third decimal is a zero, say 17.890, it just becomes 17.89
Is there a way to ensure that it is always 3 digits after the DP ?

Edit: I have a list of floats, and I want them to all have 3 decimal points for consistency.
No strings involved.

If by “formatting” you mean string formatting, then:

float number = 17.89f;
string text = string.Format( "formatted number is {0:0.000}" , number );
Debug.Log( text );

C# Online Compiler | .NET Fiddle

// or, for short:
Debug.Log( $"formatted number is {number:0.000}" );