I have a windows service that i need to run at specific time of day.Suppose the time id 11:00 PM.At present i have code to run this service on everyday but how to add time variant into this i am not able to get that. Here is my code in c#..
protected override void OnStart(string[] args)
{
timer = new Timer();
timer.Interval = 1000 * 60 * 60 * 24;//set interval of one day
timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
start_timer();
}
static void timer_Elapsed(object sender, ElapsedEventArgs e)
{
// Add your code here
readDataFromAd();
}
private static void start_timer()
{
timer.Start();
}
Please help me in defining the time also along with the interval.The time Should be 11:00 PM and the timer should execute the Method Everyday.