Search code examples
c#eventsdatetimesystemevent

Getting notified when the datetime changes in c#


Recently I was trying to make a calendar application that will display the current year-month-date to the user. The problem is, if the user is gonna keep my application running even for the next day, how do I get notified ?? How shall I change the date displayed ? I don't wanna poll the current date to update it. Is this possible in c#.

Note: I tried out the SystemEvent.TimeChanged event, but it works only if the user manually changes the time / date from the control panel.


Solution

  • Can you simply work out the number of seconds until midnight, and then sleep for that long?