TheBulgarianWolf

Day Of Week

Jan 1st, 2021
1,187
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Globalization;
  3. using System.Linq;
  4.  
  5. namespace DayOfWeek
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             CultureInfo provider = CultureInfo.InvariantCulture;
  12.             Console.WriteLine("Enter a date in the format dd-mm-yyyy: ");
  13.             string input = Console.ReadLine();
  14.             DateTime dateTime = DateTime.ParseExact(input,"dd-MM-yyyy",provider);
  15.             string dayOfWeek = dateTime.DayOfWeek.ToString();
  16.             Console.WriteLine("The day of week on this day was: " + dayOfWeek);
  17.         }
  18.     }
  19. }
  20.  
RAW Paste Data