# Conversion of seconds to hours and minutes

Hey guys, i am trying to make a timer that inclues hours and minutes, this timer goes up to 24hours and once it reaches that point it resets back to 0 and repeats. So basically a 24 hour cycle that allows me to decide how many seconds their are per day and converts those seconds to display hours and minutes. Currently my hours work fine and so do the days, but i can´t get the minutes to work, any guidance is appreciated. Here is my day/night cycle:

``````  //Update Time
void ChangeTime()
{
//Increase Time
curTime += Time.deltaTime / secondsPerDay;

IncreaseHour();

if (curTime >= 1)
{
IncreaseDay();
curTime = 0;
}

}

void IncreaseHour()
{
float hour = curTime * 24f;
float minute =  hour * 60;

if (minute >= 60)
{
minute = 0;
}
Debug.Log(minute);
ui.UpdateHour(hour);
ui.UpdateMinute(minute);
}
``````

Thanks guys,

That’s all:

``````float t = curTime * 24f;
float hours = Mathf.Floor(t);
t *= 60;
float minutes = Mathf.Floor(t%60);
t *= 60;
float seconds = Mathf.Floor(t%60);
Debug.Log(hours + ":" + minutes + ":" + seconds);
``````