2
How do I make sure that when the time on my computer reaches 12:00 it writes on the console "Hello World" every day?
2
How do I make sure that when the time on my computer reaches 12:00 it writes on the console "Hello World" every day?
1
Creates a Timer and then compares with the chosen time:
private static void Main(string[] args)
{
var t = new Timer(TimerCallback, null, 0, 1000);
Console.WriteLine("Pressione \'q\' para sair.");
while (Console.Read() != 'q') ;
}
private static void TimerCallback(object stateInfo)
{
if (DateTime.Now.Hour == 12 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
Console.WriteLine("Hello World");
}
I wish it was every day
if you leave the running application will run every day at 12:00 pm...
Browser other questions tagged c#
You are not signed in. Login or sign up in order to post.
I can’t understand what you want to ask.
– ramaral
Ready I edited..
– user92401