Like Sum8 has mentioned, you just need to check if the current date is of "Friday" or "Satureday" in your windows sevice's execution code. In other words, your windows service just keep running and fire the event once every 3 hours(based on your requirements)
and the actual functional code will only be executed if today is "Friday" or "Saturday".
for checking the dayInWeeks, there is built-in function in .NET framework. e.g.
=====================
var todayInWeek = DateTime.Now.Date.DayOfWeek;
if (todayInWeek == DayOfWeek.Saturday || todayInWeek == DayOfWeek.Friday)
{
// To the tasks here
} else
{
// Do nothing
}
=====================
Steven Cheng...
Contributor
4199 Points
548 Posts
Microsoft
Moderator
Re: Windows service runs on Firday and Saturday every 3 Hours
Mar 23, 2012 06:45 AM|LINK
Hi hardtoget410,
Like Sum8 has mentioned, you just need to check if the current date is of "Friday" or "Satureday" in your windows sevice's execution code. In other words, your windows service just keep running and fire the event once every 3 hours(based on your requirements) and the actual functional code will only be executed if today is "Friday" or "Saturday".
for checking the dayInWeeks, there is built-in function in .NET framework. e.g.
===================== var todayInWeek = DateTime.Now.Date.DayOfWeek; if (todayInWeek == DayOfWeek.Saturday || todayInWeek == DayOfWeek.Friday) { // To the tasks here } else { // Do nothing } =====================Feedback to us
Microsoft One Code Framework