From my understanding, interval is based on miliseconds in c#. However, I would wish to set my timer based on hourly.
How do I do so? Do I change the interval under the timer properties to 3600000
?
If you are concerned about the readability of your code, you could use System.TimeSpan to clarify your intent:
timer.Interval = TimeSpan.FromHours(2).Milliseconds
This will set the interval of the timer to 2 hours.
yes
but you can use something like
int hour = 1;
int setinterval = hour * 60 * 60 * 1000;
timerName.Interval = setinterval;
尝试这个 :
("YourCountdownTimer").Interval = 1 * 60 * 60 * 1000;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.