Hello. I am trying to make a digital clock and now it is accessing the time on my computer, but how could i change the time to a specific one. I need it to be starting from 00:00:00 (midnight)
This is what i have now.
public class Clock : MonoBehaviour
{
private TMP_Text textClock;
// Start is called before the first frame update
void Start()
{
textClock = this.GetComponent<TMP_Text>();
}
// Update is called once per frame
void Update()
{
DateTime time = DateTime.Now;
string hour = LeadingZero(time.Hour );
string minute = LeadingZero(time.Minute);
string second = LeadingZero(time.Second);
textClock.text = hour + ":" + minute + ":" + second;
}
string LeadingZero(int n)
{
return n.ToString().PadLeft(2, '0');
}
}