Hello I do this code for does this statement ( MessageBox.Show("done ");
) when the time is between 11:47 , 11:49
public Form1()
{
InitializeComponent();
System.Windows.Forms.Timer MyTimer = new System.Windows.Forms.Timer();
MyTimer.Interval = (1 * 60 *500 ); // 1 mins
MyTimer.Tick += new EventHandler(times);
MyTimer.Start();
}
private void times(object sender, EventArgs e)
{
DateTime t1 = DateTime.Parse("11:47:00.000");
DateTime t2 = DateTime.Parse("11:49:00.000");
TimeSpan now = DateTime.UtcNow.TimeOfDay;
if (t1.TimeOfDay <= now && t2.TimeOfDay >= now)
{
MessageBox.Show("done ");
}
but it doesn't working