Created
June 3, 2016 12:06
-
-
Save Nikola-Andreev/380b6b9a9990111beaf051ad26c1356b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Numerics; | |
using System.Globalization; | |
using System.Text.RegularExpressions; | |
using System.Threading; | |
namespace Praktice | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; | |
string startDate = Console.ReadLine(); | |
string endDate = Console.ReadLine(); | |
string format = "dd-MM-yyyy"; | |
CultureInfo provider = CultureInfo.InvariantCulture; | |
DateTime start = DateTime.ParseExact(startDate, format, provider); | |
DateTime end = DateTime.ParseExact(endDate, format, provider); | |
List<string> hollydays = new List<string>() {"01-01","03-03","01-05","06-05","24-05","06-09", "22-09", "01-11","24-12","25-12","26-12" }; | |
int count = 0; | |
for (DateTime i = start; i <= end; i = i.AddDays(1.0)) | |
{ | |
string test = i.ToString(); | |
string dateToCheck = test.Substring(3, 2)+"-"+test.Substring(0,2); | |
string a = i.DayOfWeek.ToString(); | |
if (!hollydays.Contains(dateToCheck)) | |
{ | |
if ( a !="Saturday" && a != "Sunday") | |
{ | |
count++; | |
} | |
} | |
} | |
Console.WriteLine(count); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment