Time formatting

Hey everyone,

Currently in my game I’m working on a timer. The biggest problem I’m having is with the way it’s displayed and I have no idea how to format it properly. I’ve searched through Unity and found stuff from 2006 which is quite outdated. Currently the time is displaying “1.40202392” and I want it to show “minutes:seconds” example “1:30.” Any help is welcome and much appreciated! Thank you

Slyy

In C# there a format function that allows you to do something like this: string text = string.Format (“{0:00}:{1:00}”, displayMinutes, displaySeconds);

I don’t know much about JavaScritp, but maybe this can help you:

string formattedTime = (int)(timer / 60) + “:” + (int)(timer % 60)

Off the top of my head something like that should work or at least point you in the right direction.

A script I did a while ago. It should do the trick for you : http://wiki.unity3d.com/index.php/TimeOfDay