so I'm making a calendar app in unity, but not just any calendar.. it's a custom calendar app for my friend because he doesn't like georgian, anyway my question is: I have Date.TimeNow.Hour set to get the current hour in the device and i did the calculations for the calendar, the only thing im struggling with is calling the function that does all these calculations only each day. Here is an example:
void Update()
{
int hours = DateTime.Now.Hour;
if (hours == 0)
{
calculateMonth();
}
solarHijri.text = $"{day:D2}-{month:D2}-{year:D2}";
}
So for this code i want for every new day (When hour reaches 0 or in other words 12AM) the calculateMonth function activates, it increases day by one and the other calculations are not really important. i know Update calls each frame but i wanna delay the call for 86400 seconds (a day), i tried using this method but the delay starts only when you open the app + it's not the way to do it.
void calculateMonth()
{
day++;
Debug.Log("Day today is: "+ day);
if (month == 1 || month == 2 || month == 3 || month == 4 || month == 5)
{
if (day >= 31)
{
month++;
day = 1;
}
etc